TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Adding Stroke to Polygon

Forums > SwiftUI

I just went through your tutorial "How to draw polygons and stars" and adapted it to create 5 consecutively smaller 16 sided polygons. However, I have tried without success to add a stroke and remove the fill.

I keep getting this or similar error: "/Users/scottfreedlun/Documents/iOS Stuff/App Projects/MyWhiskies/MyWhiskies/ContentView.swift:103:14 Value of type 'some View' has no member 'strokeBorder'"

Can you please point me in the right direction? I've been goig through Apples documetnaion as well. This is my first attempt at SwiftUI, though I have been working with Swift for several years.

My goal is to create a radar chart style image. I will then be adding lines connecting the points and touch points at the intersections.

1      

I think you will need to make sure that your View struct conforms to InsettableShape in order to use the strokeBorder modifier.

https://www.hackingwithswift.com/books/ios-swiftui/adding-strokeborder-support-with-insettableshape

1      

Hacking with Swift is sponsored by Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.