전체 글
-
StoreKit2 ReferencesSwift/SwiftUI 2023. 7. 9. 20:39
https://developer.apple.com/storekit/ StoreKit - Apple Developer StoreKit provides a simple and secure way for users to purchase digital goods or services in your apps across all Apple platforms. developer.apple.com https://developer.apple.com/videos/play/wwdc2023/10013/ Meet StoreKit for SwiftUI - WWDC23 - Videos - Apple Developer Discover how you can use App Store product metadata and Xcode Pr..
-
[Dart] Class and namedConstructorFlutter/Dart 2023. 6. 22. 00:23
constructor 는 initializer 와 같다 그리고 constructor 를 여러개 만들수도 있다. 방법은 아래와 같다. void main() { Man man = Man(); Man man2 = Man.namedConstructor(); Man man3 = Man.anotherContructor(); print(man.name); print(man2.name); print(man3.name); // man1 // man2 // man3 } class Man { String? name; int? age; Man() { this.name = "man1"; this.age = 1; } Man.namedConstructor() { this.name = "man2"; this.age = 2; } Ma..
-
[SwiftUI] GeometryReader 란?Swift/SwiftUI 2023. 6. 3. 10:23
좌표랑 크기등을 알수 있다 struct ContentView: View { var body: some View { VStack { Spacer() .frame(height: 200) GeometryReader { proxy in Text("Hello") .onAppear { print(proxy.size) print(proxy.frame(in: .global)) print(proxy.frame(in: .local)) print(proxy.safeAreaInsets) } } .background(Color.gray) .padding(.horizontal) Spacer() .frame(height: 200) } } } // 출력 (343.0, 247.0) // GeometryReader 의 사이즈 (넓이, ..
-
[SwiftUI] Data 로 Lottie 보여주기Swift/SwiftUI 2023. 5. 18. 01:03
struct LottieView: UIViewRepresentable { let data: Data func updateUIView(_ uiView: UIViewType, context: Context) { } func makeUIView(context: Context) -> Lottie.CompatibleAnimationView { let animationView = CompatibleAnimationView(data: data) animationView.contentMode = .scaleAspectFit animationView.play() animationView.loopAnimationCount = .infinity return animationView } }
-
[Swift] Generic 을 사용해서 로그를 편하게 찍기Swift 2023. 5. 13. 14:20
import Foundation struct SomeAPI { static func post() { Network.request(caller: self) } } struct OtherAPI { static func post() { Network.request(caller: self) } } struct Network { static func request(caller: T.Type) { print(String(describing: caller)) } } SomeAPI.post() OtherAPI.post() // 출력 SomeAPI OtherAPI
-
[Swift] Class Type 검사하기 - isMember(of: )Swift 2023. 5. 12. 16:07
class SomeVC: UIViewController { } class OtherVC: UIViewController { } func validate(type: AnyClass) { let controllers = [SomeVC(), OtherVC()] for vc in controllers { print(vc.isMember(of: type)) } } validate(type: SomeVC.self) // 출력값 true false