본문 바로가기

Programming

(143)
[SwiftUI] @Published 사용법 및 @ObservedObject와의 관계 SwiftUI의 View 및 ViewModel 관계에서 주로 쓰는게 @Published와 @ObservedObject인데요 Class FooView { @ObservedObject viewModel = FooViewModel() } Class FooViewModel: ObservableObject { @Publihsed foo: String } 이들 관계 및 사용 관련해서 이해하기 좋은 블로그를 하나 소개하려 합니다. https://pilgwon.github.io/post/published-risks-and-usage-explained [수위프트UI/번역] 코드로 알아보는 @Published의 사용법과 위험성 @Published risks and usage explained with code exampl..
[SwiftUI] VStack과 LazyVStack과의 차이 VStack과 LazyVStack 또는 HStack과 LazyHStack 기본 요지는 - VStack은 전체 데이터를 메모리에 담아두고 스크롤 할때마다 보여줌 - LazyVStack은 데이터가 화면에 렌더링 되는 순간 보여지는 순간 그려짐 둘 차이만 봐도 메모리 차이가 심할 것 같아요 (미리 화면을 다 그려놓고 보여주느냐, 렌더링 되는 순간에 그려주느냐) 그럼 많이들 쓰는List는 어떤방식이냐? 궁금했는데요 https://developer.apple.com/forums/thread/651256 를 살펴보니 "List contents are always loaded lazily" List는 모두 Lazy하게 그려준다고 하니, 스크롤 형식의 많은 내용을 보여줄때는 List를 쓰면 될 것 같습니다. 참고사이트..
개발자 코드리뷰 가이드 사이트 소개 개발자 코드리뷰 가이드 시 참고하면 좋을 내용이 있어 소개하려고 합니다. https://wnsgml972.github.io/devops/2020/05/17/CodeReview1/ 개발자 Code Review 가이드 Code Review Developer Guide 목차 이번 포스팅은 2019년 9월 5일에 구글에서 공개한 코드리뷰 가이드를 한글로 번역한 MadPlay님의 게시글과, 개발자 Kenneth Truyers 님의 게시글을 읽고, 실무에서 Code Review 문 wnsgml972.github.io
[SwiftUI] @FocusState Property Wrapper iOS 15에 추가된 FocusState Property Wrapper입니다. Focus를 자유롭게 이동시키기 위한 Property Wrapper이며 아래와 같이 선언해서 사용합니다. @FocusState var isFocusField: Bool @State var email: String UITextField("email", text: $email, prompt: Text("email")) .focus($isFocusField) 만약 포커스할 입력창 여러개 있어야 할 경우, 이렇게 각 필드마다 FocusState를 줘야하는데요 @FocusState var isFocusEmail: Bool @State var email: String @FocusState var isFocusPassword: Bool @..
Xcode Release Notes 사이트 Xcode 버전 별 주요 변경사항을 소개해주는 사이트 각 버전별 특징들을 알고 싶을 때 해당 사이트 부터 방문해서 확인 하면 됩니다. (Beta버전까지도 확인 가능합니다) https://developer.apple.com/documentation/xcode-release-notes
realm swift 강의 실무에서 활용하는 프로토콜 중심 프로그래밍 프로토콜 지향 MVVM을 소개합니다.
swift 구조체에서 protocol 사용 예제 1 struct에서 공통된 기능을 쓰기 위해서 protocol을 통해 추상화 과정을 거친다. 하지만 일부 기능은 구현이 필요 없는 경우도 존재한다. protocol Car { func stop() { } func autostop() { } } struct Truck: Car { func stop() { } func autostop() { } } struct Van: Car { func stop() { } func autostop() { } } 일부 추상화 함수를 extension을 통해 작성하게 되면, 해당 프로토콜을 채택한 struct에서 모두 구현해야할 필요가 없어지게 된다. protocol Car { func stop() { } } extension Car { func autostop() { } } s..
Rick and Morty API Rick And Morty 에니메이션의 캐릭터, 위치, 에피소트의 데이터베이스를 확인할 수 있는 API https://rickandmortyapi.com The Rick and Morty API The Rick and Morty API is a REST and GraphQL API based on the television show Rick and Morty rickandmortyapi.com REST API 관련 문서는 https://rickandmortyapi.com/documentation/ Documentation This documentation will help you get familiar with the resources of the Rick and Morty API and show you..

반응형