Deep_Dev
[iOS][Xcode] can not preview in this file ๋ฌธ์ œ ํ•ด๊ฒฐ
๐ŸŽ iOS/SwiftUI 2024. 11. 12. 00:46

์˜ค๋Š˜ ๊ฐœ๋ฐœํ•  ๋•Œ ๊ฒช์—ˆ๋˜ ๋ฌธ์ œ์ธ๋ฐ, ์ฐพ์•„๋ณด๋‹ˆ ๊ฐ„ํ˜น ์ƒ๊ธธ ์ˆ˜ ์žˆ๋Š” ๋ฒ„๊ทธ์ธ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. Xcode์—์„œ Preview์ชฝ์—์„œ 'can not preview in thie file'์ด๋ผ๊ณ  ๋œจ๊ณ  ํ”„๋ฆฌ๋ทฐ๊ฐ€ ๋‚˜์˜ค์ง€ ์•Š๋Š”๊ฒƒ์ž…๋‹ˆ๋‹ค.( fatal error ~~๋„ ์žˆ์—ˆ๋˜ ๊ฒƒ๊ฐ™์€๋ฐ ์ •ํ™•ํžˆ ๊ธฐ์–ต์€ ์•ˆ๋‚˜๋„ค์š” ! ) Xcode๋ฅผ ๊ป๋‹ค์ผฐ๋Š”๋ฐ๋„ ํ•ด๊ฒฐ๋˜์ง€ ์•Š์•˜์ง€๋งŒ,๋‹ค์Œ ์†”๋ฃจ์…˜์œผ๋กœ ๋ฐ”๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ์–ด์š”. 1. Xcode ์ข…๋ฃŒ2. ํ„ฐ๋ฏธ๋„์— ๋‹ค์Œ ๋ช…๋ น์–ด ์ž…๋ ฅ xcrun simctl --set previews delete all3. ๋‹ค์‹œ Xcodeํ‚ค๋ฉด ํ•ด๊ฒฐ ์™„๋ฃŒ

[SwiftUI] onTapGesture์—์„œ ํŠน์ • ๋ถ€๋ถ„์—์„œ ํƒญ์ด ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ
๐ŸŽ iOS/SwiftUI 2024. 11. 12. 00:42

์ผ๋ฐ˜์ ์ธ Text๋‚˜ Image๋‚˜ ์ปดํฌ๋„ŒํŠธ์— ํƒญ ์ œ์Šค์ฒ˜๋ฅผ ์ถ”๊ฐ€ํ•ด์„œ, ์‚ฌ์šฉ์ž๊ฐ€ ํƒญ ํ–ˆ์„๋•Œ ์•ก์…˜์„ ์ •์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ œ๊ฐ€ ๊ตฌํ˜„ํ•˜๋ฉด์„œ ๊ฒช์—ˆ๋˜, ๊ฐ€์žฅ ํ”ํžˆ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์˜ˆ์‹œ๋กœ ๋ฐ”๋กœ์‚ฌ์šฉ์ž๊ฐ€ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ธฐ์œ„ํ•ด Keyboard๊ฐ€ ์ผœ์ง€๊ณ , ๋นˆ ํ™”๋ฉด์„ ํ„ฐ์น˜์‹œ ํ‚ค๋ณด๋“œ๊ฐ€ ๋‹ซ๊ฒŒํ•˜๋Š” ์ƒํ™ฉ์„ ๋“ค ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์€๋ฐ์š”. VStack { // View Code}.onTapGesture { print("ํ‚ค๋ณด๋“œ๋ฅผ ๋‹ซ์Šต๋‹ˆ๋‹ค.")}์ €๋Š” ๋ถ„๋ช… ์ด๋ ‡๊ฒŒ ๊ฐ€์žฅ ํฌ๊ฒŒ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” VStack์— ํƒญ ์ œ์Šค์ฒ˜๋ฅผ ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค.์ด๋Ÿฌ๋ฉด ํ™”๋ฉด์˜ ๋นˆ๋ถ€๋ถ„์„ ํ„ฐ์น˜ํ•˜๋ฉด ํ•ด๋‹น print๋ฌธ์ด ๋‚˜์™€์•ผํ•˜์ง€์•Š์Šต๋‹ˆ๊นŒ ?  ๊ทผ๋ฐ ํŠน์ • ๋ถ€๋ถ„์—์„œ๋Š” ์•„์˜ˆ ์ž‘๋™์„ ํ•˜์ง€ ์•Š๋Š”๊ฑฐ์—์š” ? ๊ทธ๋ž˜์„œ,, Stack๊ฐ™์€๊ฒŒ ๊ฒน์ณ์„œ ์ž‘๋™์ด ์•ˆ๋˜๋Š”๊ฒƒ์ธ๊ฐ€ ? ์˜ˆ์ƒํ•˜๊ณ  ์ฐพ์•„๋ดค๋Š”๋ฐ ๊ทธ ๋ฌธ์ œ๋Š” ์•„๋‹ˆ..

[SwiftUI] TextField์—์„œ ๋‹ค์ค‘๋ผ์ธ์„ ๋งŒ๋“ค๊ธฐ
๐ŸŽ iOS/SwiftUI 2024. 11. 12. 00:34

๐Ÿ“š TextField ๋‹ค์ค‘๋ผ์ธ ๋งŒ๋“ค๊ธฐ   ํ”„๋กœ์ ํŠธ์—์„œ ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ๋ฐ›๋Š” Text Field๋ฅผ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ์—ˆ๋Š”๋ฐ, ๋””์ž์ธ์ด ์กฐ๊ธˆ์”ฉ ๋ฐ”๋€Œ๋ฉด์„œ ํ…์ŠคํŠธ ํ•„๋“œ์— ์ž…๋ ฅํ•œ ํ…์ŠคํŠธ๋“ค์ด ์—ฌ๋Ÿฌ ์ค„๋กœ ๋‚˜์™€์•ผํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทผ๋ฐ ์ €๋Š” TextField์™€ TextEditor์˜ ์ฐจ์ด์ ์ด, TextField๋Š” ํ•œ ์ค„ ๊ทธ๋ฆฌ๊ณ  TextEditor๋Š” ์—ฌ๋Ÿฌ ์ค„๋กœ ๋ช…ํ™•ํ•œ์ค„ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.๊ทธ๋Ÿฌ๋‹ˆ๊นŒ, ์—ฌ๋Ÿฌ์ค„๋กœ ํ•ด์•ผํ•œ๋‹ค๋ฉด ๋ฌด์กฐ๊ฑด TextEditor๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•˜๊ณ  ์—๋””ํ„ฐ์—๋Š” Placeholder๊ฐ€ ์—†์œผ๋ฏ€๋กœ ์ด๊ฒƒ๋„ ๋งŒ๋“ค์–ด์ค˜์•ผํ•œ๋‹ค ...placeholder๋ฅผ ์–น์œผ๋ ค๋ฉด zstack์„ ์“ฐ๋“ , overlayํ•˜๋“  ๋„ˆ๋ฌด ๋ณ€๊ฒฝํ•˜๊ธฐ ๊ท€์ฐฎ์•„์„œ,, ์Šฅ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ณด์•˜๋Š”๋ฐ์š”. TextField์—์„œ๋„ ๋‹ค์ค‘๋ผ์ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ...์ด์—ˆ์Šต๋‹ˆ๋‹ค. iOS 16์—์„œ๋ถ€ํ„ฐ ๋˜์—ˆ๋˜๊ฒƒ์ด๋ผ๊ณ ..

[SwiftUI] TabBar ํŠน์ • ๋ทฐ์—์„œ๋Š” Hide ํ•˜๊ธฐ !
๐ŸŽ iOS/SwiftUI 2024. 11. 4. 23:29

๐Ÿ“š Tabbar Hide ๐Ÿ˜Ž   ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋ฉด์„œ Tabbar๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ ๋ฉ”์ธ ํƒญ๋ฐ” ํ™”๋ฉด์—์„œ ๋„ค๋น„๊ฒŒ์ด์…˜์œผ๋กœ View๋ฅผ ์ด๋™ํ•˜๋ฉด์ด๋™๋œ View๋ถ€ํ„ฐ๋Š” Tabbar๊ฐ€ ์•ˆ๋‚˜์˜ค๊ฒŒ ํ•ด์•ผํ–ˆ์Šต๋‹ˆ๋‹ค. ์ •๋ง ๊ฐ„๋‹จํžˆ ํ•ด๊ฒฐ๋˜๋”๊ตฐ์š” ? ๐Ÿ‘A View๊ฐ€ Tabbar์˜ ๋ฉ”์ธ๋ทฐ์ด๊ณ ,A View์—์„œ Navigation์„ ํ†ตํ•ด B View๋กœ ์ง„์ž…ํ–ˆ์„๋•Œ, B View์—์„œ ํƒญ๋ฐ”๋Š” ์‚ฌ๋ผ์ง€๊ฒŒ ํ•˜๊ณ  ์‹ถ๋‹ค. ํ•œ๋‹ค๋ฉด B ํŒŒ์ผ์˜ View ์ฝ”๋“œ์—  .toolbar(.hidden, for: .tabBar) ์ด ๋ชจ๋””ํŒŒ์ด์–ด๋ฅผ ์ ์šฉํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค ! ๋”ฑ ๋ด๋„ tabbar๋ฅผ hiddenํ•ด์ฃผ๋Š”๊ฑฐ๊ฒ ์ฃ  ?  โŒ๊ทผ๋ฐ ๋ฌธ์ œ๊ฐ€ ๋ญ์˜€๋ƒ .. โŒ  A ์—์„œ B๋กœ ๊ฐˆ๋•Œ ํƒญ๋ฐ”๋Š” ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์‚ฌ๋ผ์กŒ์ง€๋งŒ, B์—์„œ ๋‹ค์‹œ A๋ทฐ๋กœ ๋‚˜๊ฐˆ๋•Œ Tabbar๊ฐ€ ๋ฐ”๋กœ ๋– ์žˆ์–ด์•ผํ–ˆ๋Š”๋ฐ๋”œ๋ ˆ์ด๊ฐ€ ์žˆ์–ด ..

[SwiftUI] NavigationLink, NavigationView ํŠ•๊ธธ ๋•Œ
๐ŸŽ iOS/SwiftUI 2024. 11. 2. 01:47

NavigationView์™€ NavigationLink๋ฅผ ์“ฐ๋ฉด์„œ ํŠ•๊ธฐ๊ณ  ์ด์ „ํ™”๋ฉด์œผ๋กœ ๊ฐ•์ œ๋กœ ๋Œ์•„๊ฐˆ ๋•Œ,NavigationView { // code}.navigationViewStyle(StackNavigationViewStyle()) ํ•ด๋‹น ๋ชจ๋””ํŒŒ์ด์–ด ์ถ”๊ฐ€ !     ์ฐธ๊ณ  ๋ ˆํผ๋Ÿฐ์Šคhttps://stackoverflow.com/questions/66559814/swiftui-navigationlink-pops-out-by-itself SwiftUI NavigationLink pops out by itselfI have a simple use case where a screen pushes another screen using the NavigationLink. There is a strange behavio..

article thumbnail
[SwiftUI]์•ฑ๋‚ด์—์„œ ์•ฑ ๋ฒ„์ „ ์ •๋ณด ํ‘œ์‹œ
๐ŸŽ iOS/SwiftUI 2024. 10. 12. 16:45

๐Ÿ“š ์•ฑ ๋‚ด ํ˜„์žฌ ์•ฑ๋ฒ„์ „ ์ •๋ณด ํ‘œ์‹œํ•˜๊ธฐ  ์•ฑ์„ ์—…๋ฐ์ดํŠธ ํ•ด๊ฐ€๋ฉด์„œ ์‚ฌ์šฉ์ž๋งˆ๋‹ค ์—…๋ฐ์ดํŠธ ์—ฌ๋ถ€์— ๋”ฐ๋ผ, ์‚ฌ์šฉ์ค‘์ธ ๋ฒ„์ „์ด ๋‹ค๋ฅผ ๊ฒƒ์ด๋ผ๋Š” ์ƒ๊ฐ๋„ ๋“ค์—ˆ๊ณ ..์ธ์•ฑ๋ฆฌ๋ทฐ๋ฅผ ๋‹ฌ๋ฉด์„œ ๊ฐ™์ด ๋ณด์ด๋Š”๊ฒƒ๋„ ๋‚˜์˜์ง€ ์•Š๊ฒ ๋‹ค ์ƒ๊ฐ์ด ๋“ค์–ด ๊ฐ„๋‹จํ•˜๊ฒŒ ์ถ”๊ฐ€ํ•˜์˜€๋Š”๋ฐ์š”. var appVersion: String { let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown" let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown" return "Version \(version) (Build \(build))"..

article thumbnail
[SwiftUI] In-App Review ์—ฐ๋™
๐ŸŽ iOS/SwiftUI 2024. 10. 12. 16:31

๐Ÿ“š ์ธ์•ฑ๋ฆฌ๋ทฐ(In-App Review) ์ด๋ฒˆ์— ํŒ€ํ”„๋กœ์ ํŠธ์˜ ๊ฐœ๋ฐœ์‹œ์ž‘์ด ์กฐ๊ธˆ์”ฉ ๊ณ„์† ๋ฏธ๋ค„์ง€๋ฉด์„œ, ๊ฐœ๋ฐœํ•˜๊ณ ์‹ถ์€๋ฐ ํ•˜์ง€๋ชปํ•ด์„œ ์ตœ๊ทผ์— ์กฐ๊ธˆ์”ฉ ์—…๋ฐ์ดํŠธํ•˜๊ณ  ์žˆ๋Š” ๊ฐœ์ธํ”„๋กœ์ ํŠธ ์•ฑ์— ์ธ์•ฑ๋ฆฌ๋ทฐ๋ฅผ ๋„ฃ์–ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ธ์•ฑ๋ฆฌ๋ทฐ๋Š” ์•ฑ ๋‚ด์—์„œ ์•ฑ์˜ ์•ฑ์Šคํ† ์–ด ํ‰์ ๊ณผ ๋ฆฌ๋ทฐ๋ฅผ ๋‚จ๊ธธ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.์‚ฌ์‹ค ์ œ๊ฐ€ ์ด๊ฑธ ์ ์šฉํ•˜๋ ค๋Š” ์•ฑ์ด ์‚ฌ์šฉ์ž๊ฐ€ ๋งŽ์ง„ ์•Š์ง€๋งŒ ๊พธ์ค€ํžˆ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ์‚ฌ๋žŒ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทผ๋ฐ ํ™•์žฅ์„ฑ์ด ๋„“์ง€ ์•Š์€ ๋‹จ์ผ ๊ธฐ๋Šฅ ์•ฑ์ด๋ผ.. ํ™•์žฅ์„ ํ•œ๋‹ค๋ฉด ์—„์ฒญ ํฌ๊ฒŒ ํ•ด์•ผํ•ด์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์˜๊ฒฌ์ด๋‚˜ ํ”ผ๋“œ๋ฐฑ์„ ์กฐ๊ธˆ ๋” ๋“ค์–ด๋ณด๊ณ  ์‹ถ์–ด์„œ ์ ์šฉํ•˜๋ คํ•ฉ๋‹ˆ๋‹ค. ์ œ๊ฐ€ SwiftUI๋ฅผ ์ฒ˜์Œ ๊ณต๋ถ€ํ•  ๋•Œ, ์ œ๊ฐ€ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ๊ฐ„๋‹จํ•˜๊ฒŒ ๋งŒ๋“ค์—ˆ๋˜ ์•ฑ์ธ๋ฐ ๋ฐฉ์น˜ํ•ด๋’€๋‹ค๊ฐ€ ๋‚˜์ค‘์— ๋ณด๋‹ˆ๊นŒ ๊ณ„์† ์“ฐ๊ณ  ์žˆ๋Š” ์‚ฌ๋žŒ์ด ์žˆ๋”๋ผ๊ตฌ์š”?์ตœ๊ทผ์— ์ด๊ฒƒ์ €๊ฒƒ ์กฐ๊ธˆ์”ฉ ์—…๋ฐ์ดํŠธ ์ค‘์ž…๋‹ˆ๋‹ค ! Stor..

article thumbnail
[WatchOS] TestFlight(๋ฐฐํฌ) ํ•  ๋•Œ ๋งŒ๋‚ฌ๋˜ identifier ํ†ต์ผ ๋ฌธ์ œ
๐ŸŽ iOS/WatchOS 2024. 9. 8. 19:26

๐Ÿ“š ์ตœ๊ทผ์—, iOS ๋ฐ Wat chOS ์•ฑ์„ TestFlight ์˜ฌ๋ฆด ๋•Œ ๋งŒ๋‚ฌ๋˜identifier ํ†ต์ผ ๋ฌธ์ œ ์ปดํŒฉํŠธํ•˜๊ฒŒ ์จ์„œ ๋‚จ๊ฒจ๋ณด์ž ํ•ฉ๋‹ˆ๋‹ค.. TestFlight ์•„์นด์ด๋ธŒ์‹œ ๋งŒ๋‚ฌ๋˜ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€ Invalid WKCompanionAppBundleIdentifier. The Info.plist of Apple Watch application 'DancingMarker.app/Watch/WatchDancingMarker Watch App.app' contains a WKCompanionAppBundleIdentifier value 'test.DancingMarker' that does not match the parent application's CFBundleIdentifier 'com.test.Danc..