SwiftUI
-
SwiftUI - Passing EnvironmentObjectSwiftUI 2022. 3. 17. 02:31
SwiftUI 에서 EnvironmentObject 는 매우.. 강력하다 import SwiftUI @main struct DeeepMemoApp: App { @Environment(\.scenePhase) var scenePhase let memoEditVM = MemoEditViewModel() let folderEditVM = FolderEditViewModel() let folderOrder = FolderOrder() let memoOrder = MemoOrder() var body: some Scene { return WindowGroup { HomeView() .environment(\.managedObjectContext, persistenceController.container.viewC..
-
SwiftUI - Action sheetSwiftUI 2022. 1. 13. 18:02
There are a couple of reasons you would use this method over the Boolean variable. First, none of the views discussed in this chapter can be used more than once for a view. If you try to attach two alert views, for example, only the last one will work. You can attach an alert, modal, or action sheet to sibling views in a view hierarchy, but you can’t attach more than one to the same view (or to ..
-
PassthroughSubject VS CurrentValueSubjectSwiftUI/Basic Property Wrappers 2021. 12. 10. 19:29
PassthroughSubject A subject that broadcasts elements to downstream subscribers. Declaration final class PassthroughSubject whereFailure : Error Overview As a concrete implementation of Subject, the PassthroughSubject provides a convenient way to adapt existing imperative code to the Combine model. Unlike CurrentValueSubject, a PassthroughSubject doesn’t have an initial value or a buffer of the ..
-
-
SwiftUI ) StateObject Apple Documentation 번역SwiftUI/Basic Property Wrappers 2021. 10. 5. 19:44
StateObject Observable Object 의 instance 를 만들 때 사용하는 Property Wrapper ( iOS 14 이상에서만 가능.. 아마도 SwiftUI 2.0 이상?) Observed Object ( Binding Object 라고 생각하면 편해요. (State Binding 은 두 views 사이에서만! ) class도 Object가 될 수 있음. 단, ObservableObject를 conform해야함. (class CustomClass: ObservableObject) class 라서 여러 properties, methods 를 가질 수 있고, 각 properties 는 선택적으로 @Published wrapper 를 씌울 수 있음. 이게 씌인 것들은 변할 때마다 vi..
-
SwiftUI) State, ObservedObject, StateObject, and EnvironmentObject보호글 2021. 9. 13. 18:42
보호되어 있는 글입니다.