iOS
-
[iOS] SnapshotTesting with SwiftUI (v1.11.0)iOS 2023. 4. 5. 08:48
SnapshotTesting SnapshotTesting์ ํตํด UI์ ์ ํจ์ฑ์ ๊ฒ์ฌํ๊ณ , ์ฝ๋ ๋ณ๊ฒฝ์ด ๋น๋ํ UI์ ์ํฅ์ ๋ฏธ์น์ง ์์๋์ง ํ์ธํ๋ค. SnapshotTesting์ด๋? Snapshot Test๋ฅผ ์ฌ์ฉํ๋ฉด ํ ์คํธ ์์ ์ UI์ ์ค๋ ์ท์ ๊ธฐ์ค์ (baseline)์ด๋ผ๊ณ ํ๋ ์ ํจํ UI ์ค๋ ์ท๊ณผ ๋น๊ตํ์ฌ UI๋ฅผ ๊ฒ์ฆํ ์ ์์ต๋๋ค. ํ ์คํธ ๋ฌ๋๋ ํ์ฌ ์ค๋ ์ท์ ๊ธฐ์ค ์ค๋ ์ท๊ณผ ๋น๊ตํ๊ณ , ์ค๋ ์ท ๊ฐ์ ์ฐจ์ด๊ฐ ์์ ๊ฒฝ์ฐ, UI๋ ๋ณ๊ฒฝ๋ ๊ฒ์ด๋ฏ๋ก ํ ์คํธ๊ฐ ์คํจํฉ๋๋ค. GitHub - pointfreeco/swift-snapshot-testing: ๐ธ Delightful Swift snapshot testing. ๐ธ Delightful Swift snapshot testing. Contribute ..
-
[iOS] Sharing Framework?iOS 2023. 2. 3. 09:51
iOS, tvOS, watchOS์์ ๋ชจ๋ ๊ณต์ ํ ์ ์๋ ํ๋ ์์ํฌ๋ฅผ ์์ฑํ ์ ์๋๊ฐ? ๊ฒฐ๋ก ์ ๋ถ๊ฐ๋ฅํ๋ค! ์๋ํ๋ฉด, ํ๋ ์์ํฌ๋ ๊ณต์ ํ ์ ์๊ณ , ์ฝ๋๋ง ๊ณต์ ํ ์ ์๋ค๊ณ ํ๋ค. ์ฑ๋ค์ ์๋ก ๋ค๋ฅธ ์ํคํ ์ณ๋ฅผ ๊ฐ์ง ๋ณ๋์ ํ๋ซํผ (iOS, tvOS, ..)์์ ์คํ๋๊ธฐ ๋๋ฌธ์, ์์ค ํ์ผ๋ค์ ๊ฐ ํ๋ซํผ์ ๋ํด ๋ณ๋๋ก ์ปดํ์ผ๋์ด์ผํ๋ค. ๊ทธ๋์ iOS ํ๋ ์์ํฌ๊ฐ ์ด๋ฏธ ์๋ ๊ฒฝ์ฐ, ํ๋ ์์ํฌ๋ฅผ ๋ณต์ ํด์ ํด๋น ํ๋ ์์ํฌ๊ฐ ๋ค๋ฅธ OS๋ฅผ ์ง์ํ๋๋ก ์์ ํ ์ ์๋ค. Combined Watch OS and iOS Framework I have created a class that is shared between iOS and Watch OS. This works just fine. However, I wante..
-
[iOS] Command CompileSwiftSources failed with a nonzero exit code ์ค๋ฅ ํด๊ฒฐiOS 2022. 7. 8. 02:45
๋ฉ์ฉกํ๊ฒ ์ ๋น๋๋๊ณ ์คํ๋๋ ์ฑ์ด.. ๊ฐ์๊ธฐ ์ด์ํ ์ค๋ฅ๋ฅผ ๋ง ๋ด๋ฉด์ ๋น๋๊ฐ ๋์ง ์์๋ค ๐ฑ ์ค๋ฅ๋ ๋ค์๊ณผ ๊ฐ์๋ค. Command CompileSwiftSources failed with a nonzero exit code์ ๊ฐ์ ์ค๋ฅ๋ค์ด ์ค์ค์ด ๋์๊ณ .. ์์ธํ ์ค๋ฅ ๋ฉ์์ง๋ ๋ค์๊ณผ ๊ฐ์๋ค. CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'RxSwift' from project 'RxSwift') CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Kingfisher' from project 'Kingfishe..
-
[iOS] ํ์ ์๋ฆผ์ฐฝ ๊ตฌํ ์ค ๋ฐ์ํ Cannot be called with asCopy = NO on non-main thread. ๋ฌธ์ ํด๊ฒฐiOS 2022. 7. 7. 01:21
๋๋ ์๋ ๋ณดํต ํ์ ์๋ฆผ์ฐฝ์ ๋ค์๊ณผ ๊ฐ์ด UIViewController์ extension์ผ๋ก ๋ง๋ค์ด์ ์ฌ์ฉํ๊ณค ํ๋ค. import UIKit extension UIViewController { func alert(title: String = "์๋ฆผ", message: String, okTitle: String = "ํ์ธ", handler: ((UIAlertAction) -> Void)? = nil) { let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) let okAction = UIAlertAction(title: okTitle, style: .default, handler: handler) ale..
-
[iOS] Coordinator Design Pattern ๋ฒ์ญiOS 2022. 5. 26. 13:03
Coordinator Design Pattern ๋ฒ์ญ Coordinator Design Pattern์ ์ฌ์ฉํ๋ฉด, ์ฑ์ ํ๋ฆ์ ์ ์ดํ ์ ์๊ณ ๋ด๋น๊ฒ์ด์ ๋ก์ง์ ์ปจํธ๋กค๋ฌ์ ์ง์ ๋ฃ๋ ๊ฒ์ ํผํ ์ ์์ต๋๋ค. ๋ํ ๋ทฐ์ปจํธ๋กค๋ฌ๋ฅผ ์๋ก ๋ถ๋ฆฌํ๋๋ฐ ๋์์ด ๋๊ธฐ ๋๋ฌธ์ ํ๋ก์ ํธ ์ ์ฒด์์ ๋ทฐ์ปจํธ๋กค๋ฌ๋ฅผ ์ฌ์ฌ์ฉํ ๋ ์ ์ฉํฉ๋๋ค. ๋ค์ ๋ถ๋ถ์ ๋ค๋ฃน๋๋ค. ๊ฐ๋ณ ์ฝ๋๋ค์ดํฐ ์์ฑ ์ฝ๋๋ค์ดํฐ ํ๋ฆ ํ์ฉ ์ฝ๋๋ค์ดํฐ๋ฅผ ์ฌ์ฉํ์ฌ ๋ทฐ์ปจํธ๋กค๋ฌ ๊ฐ์ ๋ฐ์ดํฐ ์ ๋ฌ ํ๋ก์ ํธ์ ์์ค ์ฝ๋๋ ํ๋จ์์ ํ์ธํ ์ ์์ต๋๋ค. ์์ํ๊ธฐ ๋จผ์ ๋ชจ๋ Coordinator๊ฐ ์ค์ํ ํ๋กํ ์ฝ Coordinator๋ฅผ ์์ฑํด๋ณด๊ฒ ์ต๋๋ค. import UIKit protocol Coordinator { func start() func coordinate(to co..
-
[iOS] safeAreaLayoutGuideiOS 2022. 5. 26. 02:58
๊ณต์ ๋ฌธ์ ๋ด์ฉ safeAreaLayoutGuide๋, bar๋ ๋ค๋ฅธ content๋ก ์ธํด์ ๊ฐ๋ ค์ง์ง ์๋ ๋ทฐ ๋ถ๋ถ์ ๋ํ๋ด๋ layout guide ์ด๋ค. ๋ทฐ๊ฐ ํ๋ฉด์ ํ์๋ ๋, ์ด guide๋ navigation bar, tab bar, toolbar ๊ทธ๋ฆฌ๊ณ ๊ธฐํ ์์ ๋ทฐ์์ ๋ค๋ฃจ์ง ์๋ ๋ทฐ ๋ถ๋ถ์ ๋ฐ์ํ๋ค. (tvOS์์ safe area๋ ํ๋ฉด์ ๋ฒ ์ ค์ ๊ฐ๋ฆฌ์ง ์๋ ์์ญ์ ๋ฐ์ํ๋ค.) ๋ทฐ๊ฐ ํ์ฌ ๋ทฐ ๊ณ์ธต์ด install ๋์ด์์ง ์๊ฑฐ๋ ์์ง ํ๋ฉด์ ํ์๋์ง ์์์ ๊ฒฝ์ฐ, layout guide๋ ๋ทฐ์ ๊ฐ์ฅ์๋ฆฌ์ ๋์ผํ๋ค. ๋ทฐ์ปจํธ๋กค๋ฌ ๋ฃจํธ๋ทฐ์ ๊ฒฝ์ฐ, layout guide๋ status bar, ๋ค๋ฅธ ๋ณด์ฌ์ง๋ bar๋ ๋ทฐ์ปจํธ๋กค๋ฌ์ additionalSafeAreaInsets ์์ฑ์ ์ฌ์ฉํ์ฌ ์ง์ ํ..
-
[iOS] SwiftLint ์ ์ฉํ๊ธฐiOS 2022. 5. 10. 16:59
SwiftLint๋? SwiftLint๋ ์ฝ๋์ ์คํ์ผ ์ค๋ฅ๋ฅผ ํ์ํ๋๋ฐ ๋์์ด ๋๋ ์ ์ํ ์ฝ๋ ์คํ์ผ ๋ถ์ ๋๊ตฌ์ด๋ค. ์คํ์ผ์ ๋ฐ๋ฅด์ง ์์ ๋, ๋น๋๋ฅผ ์คํจ๋ก ํ์ํ๊ฑฐ๋ ๊ฒฝ๊ณ ๋ฅผ ํ์ํ์ฌ ์คํ์ผ์ ์ ์ฉํ๋๋ฐ ๋์์ ์ค๋ค. 1. ์ฝ์ฝ์ํ ์ค์นํ๊ธฐ pod 'SwiftLint' 2. Script ์ถ๊ฐํ๊ธฐ Target → Build Phase → + → New Run Script Phase Run Script์ ์๋ ์ฝ๋๋ฅผ ์ถ๊ฐํ๋ค. ${PODS_ROOT}/SwiftLint/swiftlint ๊ทธ๋ฆฌ๊ณ Run Script ์ด๋ฆ์ SwiftLint Script๋ก ๋ณ๊ฒฝํ๋ค. ๊ทธ๋ฆฌ๊ณ ์์น๋ฅผ Compile Sources ์๋ก ์ฌ๋ ค์ฃผ์๋ค! ์ด๋ ๊ฒ ํ๋ฉด, ์ปดํ์ผ ์ ์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํด์ SwiftLint ๋ฃฐ ๊ฒ์ฌ๋ฅผ ๋จผ์ ์ง..
-
[iOS] SnapKit ์ฌ์ฉํ๊ธฐiOS 2022. 5. 10. 03:46
SnapKit์ด๋? ๊ฐ๊ฒฐํ ์ฝ๋๋ก NSLayoutConstraint๋ฅผ ์ฝ๊ฒ ์ ์ดํ ์ ์๋๋ก ํด์ค๋ค. ์ฆ, ์งง์ ์ฝ๋๋ก ์คํ ๋ ์ด์์์ ๊ตฌํํ ์ ์๋๋ก ๋์์ฃผ๋ ํ๋ ์์ํฌ์ด๋ค. ์คํ ๋ ์ด์์ ๋ฐ ์ ์ฝ ์กฐ๊ฑด์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋๋ก ํ๋ DSL (Domain-specific language). DSL์?! Domain specific language (DSL)์ ํน์ ๋๋ฉ์ธ์ ํํ, ์ฒ๋ฆฌํ๊ฑฐ๋ ํน์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ง๋ค์ด์ง ์ธ์ด์ด๋ค. SnapKit์ ๊ฒฝ์ฐ, ์คํ ๋ ์ด์์ ์ ์ฝ ์กฐ๊ฑด์ ๋ํด ํจ์ฌ ๋ ์ง๊ด์ ์ด๊ณ ์ฌ์ฉํ๊ธฐ ์ฌ์ด ๊ตฌ๋ฌธ์ ๋ง๋๋ ๊ฒ์ ๋ชฉํ๋ก ํ๋ค. ๋จผ์ ์ฝ์ฝ์ํ์ผ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐํ๊ธฐ! https://github.com/SnapKit/SnapKit pod 'SnapKit', '~> 5.6.0' ์ด..