[Swift | iOS] SwiftUI Annotations
// UploadPostView.Swift
Button.sheet(isPresented, onDismiss, content)
Method to present modal view. This method waiting until @State
variable for isPresented
is changed. If modal was dismissed, execute the method for onDismiss
.
Then the @State
var is no longer nil
, hit the else
block, and we upwrap the selected image.
@State, @Binding
how to link one variable between two files
// UploadPost/UploadPostView.swift
@State private car selectedImage: UIImage?
Create a state variable in the parent view
// Utils/ImagePicker.swift
@Binding var image: UIImage?
Create a binding variable in the view that doing another stuff.
@EnvironmentObject
It's shared data that every view can read if they want to.
유저의 로그인 정보를 유지
ObservedOject
Published
Author And Source
이 문제에 관하여([Swift | iOS] SwiftUI Annotations), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@dayo2n/SwiftUI-Annotations저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)