iOS , Swift , SwiftUI

SwiftUI Tips

Posted on:

SwiftUI with Packages I’ve been refactoring a codebase into reusable systems today. When you have a View as part of a package, the following have to be public: the View, the Init, and body. SwiftUI Environments api is iOS 17 or newer, doesn’t work inside of ViewModels, only inside of […]

iOS , Swift , SwiftUI

SwiftUI Tip

Posted on:

If you want to use label color while inside of SwiftUI use Color.init(cgColor: UIColor.secondaryLabel.cgColor) You can swap out the secondaryLabel for any of the other system colors, including background, label and many others.

iOS , Swift , SwiftUI

SwiftUI Tip

Posted on:

If you are trying to put multiple buttons inside of a list item, make sure you put .buttonStyle(.plain) on the parent most component in the list item. This caused me a some confusion on why it was deleting the wrong element of the inner list.