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

SOLVED: How to create this SF Symbol icon?

Forums > SwiftUI

Hello everyone,

currently I'm creating an app where users can draw in a canvas. They are able to turn on using the pencil.

In the Freeform app from Apple they have a icon for this (see above). How can I create this icon, since a filled icon is not available in SF Symbols. Is it a custom icon not available in SF Symbols maybe?

Off / On

Left one is when deactivated, right one when it's activated.

2      

Can you set a foreground and/or a background color? Perhaps it's the same symbol but with different colors? I'm currently not on my Mac so I can't test it myself.

2      

Thanks for the reply @Hatsushira!

Indeed, it was much more easy than I initially thought.

The solution was setting the background and fill it with a circle.

if self.pencilMode {
    HStack {
        Image(systemName: "pencil.tip.crop.circle").foregroundColor(.white).background(
            Circle()
                .fill(.red)
                .frame(width: 24, height: 24)
        )
    }
} else {
    HStack {
        Image(systemName: "pencil.tip.crop.circle")
    }
}

2      

Just a word of caution in case you weren't aware. The info attached to that symbol says, "This symbol may not be modified and may only be used to refer to Apple's Markup feature." Hopefully, what you're doing doesn't constitute modification?

2      

@magnas35 I am aware of this indeed. But since they are doing the exact same thing in their own app, I hope this will be allowed during review.

Thanks for pointing this out though!

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free 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.