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

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 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.