At first both look same. The @StateObject and @ObservedObject property wrapper tell a SwiftUI view to update in response to changes from an observed object (mostly viewmodel). Both… Read more “Difference between @ObservedObject and @StateObject”
Category: SwiftUI
Multiple gestures recognise at the same time using simultaneousGesture()
.onTapGesture allows to tap only layer of design but .simultaneousGesture identify and allows touch to multiple layer
SwiftUI Coding standards
SwiftUI coding standards If code is repetitive make subview to reuse code Repetitive code Common code (can provide default value too) Reuse code
GeometryReader
https://www.hackingwithswift.com/quick-start/swiftui/how-to-provide-relative-sizes-using-geometryreader GeometryReader to the Rescue What the Parent Wants When coding your custom view, you often do not need to worry about surroundings or sizing. For example,… Read more “GeometryReader”
SwiftUI Concepts
SwiftUI is available from iOS13. What is swift UI? Till now we were using UIKit to make design which is imperative way of doing design. But SwiftUI… Read more “SwiftUI Concepts”
How to pass / communicate data from one view to another using @Binding in SwiftUI?
Even if we change value any view it will update in for both the view
What is @EnvironmentObject in SwiftUI?
A dynamic view property that uses a bindable object supplied by an ancestor view to invalidate the current view whenever the bindable object changes.In practice the main… Read more “What is @EnvironmentObject in SwiftUI?”
SwiftUI Design Concepts
Views: VStack : arrange views vertically HStack : arrange views horizontally ZStack : arrange views one on another Color.purple : will create view of purple color SF… Read more “SwiftUI Design Concepts”