blog
blog copied to clipboard
π What you don't know is what you haven't learned
Note - Navigation state needs to be in the container of NavigationSplitView for changes to propagate - Need to use WindowGroup for navigation bar to work [NavigationSplitView](https://developer.apple.com/documentation/swiftui/navigationsplitview) > the navigation...
NavigationLink on Mac applies the default button style. We can style it using `ButtonStyle`, here to use plain style we can just ```swift NavigationLink(value: DetailRoute.books) { BooksView() } .buttonStyle(.plain) ```
[EnvironmentValues](https://developer.apple.com/documentation/swiftui/environmentvalues) Views in SwiftUI can react to configuration information that they read from the environment using an [Environment](https://developer.apple.com/documentation/swiftui/environment) property wrapper Updated for iOS 17
Use `HStack` with `TextField` and a little extension ```swift extension Binding where Value == Int { var toString: Binding { Binding( get: { "\(wrappedValue)" }, set: { wrappedValue = Int($0)...
For iOS 16 and macOS 13.0 ```swift TextEditor(text: $text) .scrollContentBackground(.hidden) ``` For below, use [[SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect)](https://github.com/siteline/SwiftUI-Introspect) ```swift TextEditor(text: $text) .instrospectTextView { $0.drawsBackground = false } ```
[WWDC23](https://developer.apple.com/wwdc23/) introduces lots of new additions to SwiftUI, notably Metal shader support with these modifiers - [colorEffect](https://developer.apple.com/documentation/swiftui/view/coloreffect(_:isenabled:)): Returns a new view that applies shader to self as a filter effect...
Interesting SwiftUI Q&A during WWDC23 ### Observable vs ObservableObject Q: With the new SwiftUI @Observable macro, are there any cases where ObservableObject would still be a better alternative? A: Use...
Interesting SwiftUI Q&A during WWDC21 ### @StateObject or ObservedObject? Q: Letβs say I have a purely SwiftUI flow. I have a ListView with a @StateObject var listFetcher, that makes requests...
[WWDC23](https://developer.apple.com/wwdc23/sessions/) brings new additions to SwiftUI ## Scrolling > The scroll transition modifier is very similar to the visual effect modifier Curt used earlier for the welcome screen. It lets...
Here are my favorite iOS articles - [Why Your App Looks Better in Sketch ](https://medium.com/@nathangitter/why-your-app-looks-better-in-sketch-3a01b22c43d7) - [Managing objects using Locks and Keys in Swift](https://www.swiftbysundell.com/articles/managing-objects-using-locks-and-keys-in-swift/) - [Proof in Functions](https://www.fewbutripe.com/swift/math/2015/01/06/proof-in-functions.html) - [When...