본문 바로가기

SwiftUI

(11)
SwiftUI animations(애니메이션) SwiftUI에서 animations에 대해서 공부해보고자 한다. animation(_:value:) Applies the given animtaion to this view when the specified value changes. animation 메소드를 통해 호출한 view와 하위 view에 animation을 적용할 수 있다. 뷰에 animation()을 추가하면 기본 시스템 애니메이션을 사용하여 해당 보기에 발생하는 모든 변경 사항을 자동으올 애니메이션화 할 수 있다. 애니메이션화를 한다는 것은 시작상태에서 종료상태로 해당 view의 상태를 변화시키는 것이다. 이를 위해선 해당 view가 시작상태와 종료상태를 가지고 있어야 한다. .easeOut, .easeIn 등을 사용하여 애니메이션의 유..
SwiftUI LifeCycle 오늘은 SwiftUI의 LifeCycle에 대해서 공부해보려고 한다. swift를 공부하면 ViewController의 LifeCycle에 대해서 먼저 공부할텐데 ViewContoller의 LIfeCycle은 많지만 SwiftUI의 LIfeCycle은 간단하다. onAppear(perform:) Adds an action to perform before this view appears 뷰가 나타날 때 수행할 액션 추가 onDisappear(perform:) Adds an action to perform after this view disappears 뷰가 사라질 때 수행할 액션 추가 2개의 뷰를 만들고 Navigation으로 뷰 전환을 실행해 보았다. struct LifeCycle: View { var ..
SwiftUI @AppStorage swiftUI를 조금씩 공부하면서 키워드를 하나씩 정리해 나가고 있다. 오늘은 @AppStorage에 대해서 알아보겠다. (공식문서 내용) A property wrapper type that reflects a value from UserDefaults and invalidates a view on a change in value in that user default. @AppStorage는 간단히 말해 다음과 같이 말할 수 있다. UserDefault의 SwfitUI버전 App의 전역범위에 데이터 공유 가능 Binding으로 서브뷰로 전달하여 데이터를 바로 업데이트 가능 사용 방법 @AppStorage("KEY") var Name: Type = Value @AppStorage 뒤에는 "고유 값"을 적어..