iOS Dev/SwiftUI
-
[SwiftUI][Lottie] Lottie for SwiftUIiOS Dev/SwiftUI 2023. 10. 9. 02:01
https://github.com/airbnb/lottie-ios/discussions/2189 Lottie 4.3.0 now available, with official support for SwiftUI · airbnb/lottie-ios · Discussion #2189 Today we released Lottie 4.3.0. This version adds many new features, including: Official support for SwiftUI! A public Core Animation CALayer subclass Support for reduced motion Support for drop sh... github.com Lottie가 SwiftUI 대응을 해줬다. 원래 스유에..
-
[SwiftUI] Back Button Custom하기iOS Dev/SwiftUI 2023. 10. 9. 00:46
SwiftUI에서 back button을 커스텀하기 어렵다. 그럴 때는 다음 코드를 넣어주자. struct BackButton: View { @Environment(\.dismiss) private var dismiss var color: Color = .black var body: some View { Button { dismiss() } label: { Image(systemName: "chevron.backward") .renderingMode(.template) .foregroundColor(color) .shadow(radius: 2.0) .contentShape(Rectangle()) } } } struct BackButtonModifier: ViewModifier { let color: Co..
-
[Tuist][TCA] EXC_BAD_ACCESS 에러가 뜰 때iOS Dev/SwiftUI 2023. 10. 2. 02:46
Tuist에서 TCA를 사용해서 모듈을 나눌 때 뜬금없이 다음 에러가 뜰 때가 있었다. 정확히는, viewStore.send(:) 에서 뜬다. Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) 메모리를 잘못 참조하고 있다는데.. 저는 코드를 다 맞게 짰는데요?! 기존 상태는 다음과 같은 상태였다. Interface에 Reducer들을 넣어두고 가장 위의 DoForest App타겟에서 Scope로 넣어줬다. 하지만 안먹힌다. 왜지?!?!??? 사실 해결하고 나서도 왜 그런지는 모르겠지만 나름 추측해보면 현재 Reducer가 담겨있는 Interface들은 dynamic framework이다. Scope으로 넣어준 Reducer와 실제 store로 사용할 때 다른 메모리 주소..
-
[SwiftUI] Square Shape를 활용하여 Image 조정하기iOS Dev/SwiftUI 2023. 7. 3. 22:37
SwiftUI에는 미리 정의된 여러가지 Shape들이 있다. Rectangle(), Circle(), RoundedRectangle() 등이 있다. 하지만 Square()는 없다. 그래서 직접 Path를 만들어서 넣어주자. struct Square: Shape { func path(in rect: CGRect) -> Path { let side = min(rect.maxX, rect.maxY) return Path { path in path.move(to: CGPoint(x: rect.midX, y: rect.midY - side / 2)) path.addLine(to: CGPoint(x: rect.midX + side / 2, y: rect.midY - side / 2)) path.addLine(to:..
-
[SwiftUI] 8. Interfacing with UIKit [마지막]iOS Dev/SwiftUI 2023. 5. 11. 01:41
SwiftUI로 이루어진 뷰에 UIKit 요소를 적용시킬 수 있을까? 이번 튜토리얼에서는 UIKit 요소를 어떻게 활용할 수 있는지를 알아본다. Section 1. Create a View to Represent a UIPageViewController UIView 요소를 사용하고 싶다면 UIViewRepresentable을, UIViewController 요소를 사용하고 싶다면 UIViewControllerRepresentable 프로토콜을 채택해야 한다. Views 그룹에 PageView 라는 이름의 그룹을 만들고, 그 안에 PageViewController.swift 파일을 만든다. 다음과 같은 내용으로 채워준다. import SwiftUI import UIKit struct PageViewCont..
-
[SwiftUI] 7. Working with UI ControlsiOS Dev/SwiftUI 2023. 5. 6. 23:44
https://developer.apple.com/tutorials/swiftui/working-with-ui-controls Working with UI Controls | Apple Developer Documentation In the Landmarks app, users can create a profile to express their personality. To give users the ability to change their profile, you’ll add an edit mode and design the preferences screen. developer.apple.com 이제 UI Control 요소들과 어떻게 상호작용하는지 알아보자. Section 1. Display a Use..
-
[SwiftUI] 6. Composing Complex InterfacesiOS Dev/SwiftUI 2023. 5. 4. 01:50
https://developer.apple.com/tutorials/swiftui/composing-complex-interfaces Composing Complex Interfaces | Apple Developer Documentation The category view for Landmarks shows a vertically scrolling list of horizontally scrolling landmarks. As you build this view and connect it to your existing views, you’ll explore how composed views can adapt to different device sizes and orientations. developer..
-
[SwiftUI] 5. Animating Views and TransitionsiOS Dev/SwiftUI 2023. 5. 4. 00:47
https://developer.apple.com/tutorials/swiftui/animating-views-and-transitions Animating Views and Transitions | Apple Developer Documentation When using SwiftUI, you can individually animate changes to views, or to a view’s state, no matter where the effects are. SwiftUI handles all the complexity of these combined, overlapping, and interruptible animations for you. developer.apple.com Section 1..
-
[SwiftUI] 4. Drawing Paths and ShapesiOS Dev/SwiftUI 2023. 4. 30. 17:04
https://developer.apple.com/tutorials/swiftui/drawing-paths-and-shapes Drawing Paths and Shapes | Apple Developer Documentation Users receive a badge whenever they visit a landmark in their list. Of course, for a user to receive a badge, you’ll need to create one. This tutorial takes you through the process of creating a badge by combining paths and shapes, which you then overlay developer.apple..
-
[SwiftUI] 3. Handling User InputiOS Dev/SwiftUI 2023. 3. 30. 03:10
https://developer.apple.com/tutorials/swiftui/handling-user-input Handling User Input | Apple Developer Documentation In the Landmarks app, a user can flag their favorite places, and filter the list to show just their favorites. To create this feature, you’ll start by adding a switch to the list so users can focus on just their favorites, and then you’ll add a star-sh developer.apple.com 이제 지금까지..