UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.