Deep_Dev
[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๊ฐ€ ๋ฐ”๋กœ ๋– ์žˆ์–ด์•ผํ–ˆ๋Š”๋ฐ๋”œ๋ ˆ์ด๊ฐ€ ์žˆ์–ด ..

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

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

article thumbnail
[SwiftUI] TextEditor BackgroundColor ์ ์šฉ
๐ŸŽ iOS/SwiftUI 2024. 4. 22. 10:27

TextEditor์˜ Background Color๋ฅผ ์ ์šฉํ•˜๋ ค๋ฉด .scrollContentBackground(.hidden)์œผ๋กœ ๊ธฐ๋ณธ ๋ฐฐ๊ฒฝ์„ ์ˆจ๊ธฐ๊ณ  .background(.clear)๋ฅผ ์ ์šฉํ•˜๋ฉด ๋œ๋‹ค. ์ด ์ƒํƒœ์—์„œ, TextEditor(text: $memoContent) //.scrollContentBackground(.hidden) .background(.red) .padding() .background(.red) .cornerRadius(10) .lineSpacing(10) ์ฃผ์„์„ ์ง€์›Œ์ฃผ๋ฉด, TextEditor(text: $memoContent) .scrollContentBackground(.hidden) .background(.red) .padding() .background(.red) .corne..

article thumbnail
[iOS][SwiftUI] @State @Binding
๐ŸŽ iOS/SwiftUI 2024. 1. 7. 00:08

๐Ÿ“š @State @Binding Property Wrapper์— ๋Œ€ํ•ด์„œ State โœ… PropertyWrapper ? ๋ณ€ํ™”๊ฐ€ ์ƒ๊ธฐ๋ฉด ํ•ด๋‹น ๋ณ€์ˆ˜์˜ ๊ฐ’์„ ์ฝ๊ฑฐ๋‚˜ ์ƒˆ๋กœ ์“ธ ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•œ๋‹ค. SwiftUI์—์„œ๋Š” property wrapper๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ณ€์ˆ˜์˜ ๋ณ€ํ™”์™€ ํ•ด๋‹น ์ž‘์—…์„ ์ž๋™ํ™” ํ•  ์ˆ˜ ์žˆ๋‹ค. SwiftUI๋Š” state๋กœ ์„ ์–ธ๋œ ํ”„๋กœํผํ‹ฐ๋“ค์˜ ์ €์žฅ์†Œ๋ฅผ ๊ด€๋ฆฌํ•œ๋‹ค. StateValue ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ทฐ๋Š” ํ•ด๋‹น value์˜ appearance๋ฅผ ๋ฌดํšจํ™”ํ•˜๊ณ  ๋‹ค์‹œ ๊ฐ’์„ ๊ณ„์‚ฐํ•œ๋‹ค. State ๋ณ€์ˆ˜ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด View๋Š” ์ƒˆ๋กœ ๋žœ๋”๋ง์„ ํ•˜์—ฌ ํ•ญ์ƒ ์ตœ์‹  ๊ฐ’์„ ๊ฐ€์ง„๋‹ค. State ์ธ์Šคํ„ด์Šค๋Š” ๊ทธ ์ž์ฒด๋กœ ๊ฐ’์ด ์•„๋‹Œ, ๊ฐ’์„ ์ฝ๊ณ  ์“ฐ๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. ํ˜„์žฌ ๋ทฐ UI์˜ ํŠน์ •์ƒํƒœ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•ด ๋งŒ๋“ค์–ด์ง„๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ณดํ†ต Priv..

article thumbnail
[iOS][SwiftUI] Save Color in UserDefaults
๐ŸŽ iOS/SwiftUI 2024. 1. 1. 14:41

๐Ÿ“š Save Color in UserDefaults from Color Picker variable in Color Data private let COLOR_KEY = "COLOR" private let userDefaults = UserDefaults.standard saveColor func saveColor(color: Color) { let color = UIColor(color).cgColor if let components = color.components { userDefaults.set(components, forKey: COLOR_KEY) } } loadColor func loadColor() -> Color { guard let colorComponenets = userDefaults...

article thumbnail
[iOS][SwiftUI] Init ()
๐ŸŽ iOS/SwiftUI 2023. 12. 28. 22:11

๐Ÿ“š ์ดˆ๊ธฐํ™”์— ๋Œ€ํ•ด์„œ AppDelegate() init() AppDelegate๋ฅผ ์ด์šฉํ•œ ์ดˆ๊ธฐํ™” ์ด ๋ฐฉ๋ฒ•์€ ์‚ฌ์‹ค AppDelegate์˜ ์—ญํ• (์ง„์ž…์ )์„ ํ•˜๋Š” ๊ฒƒ์ด ๋”ฐ๋กœ ์กด์žฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ถŒ์žฅ๋˜์ง€๋Š” ์•Š๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. @main struct PushMessageApp: App { var body: some Scene { WindowGroup { ContentView() } } } ์œ„ ์ฝ”๋“œ์—์„œ ๋ณด์ด๋Š” App ํ”„๋กœํ† ์ฝœ ์ž์ฒด๊ฐ€ ์•ฑ์˜ ๊ตฌ์„ฑ์„ ๋‹ด๋‹นํ•˜๋Š” ๊ตฌ์กฐ์ฒด์— ํ”„๋กœํ† ์ฝœ์„ ์ง€์ •ํ•ด์ฃผ์–ด์„œ ์•ฑ์˜ ์‹œ์ž‘(Presenting) ์ง€์ ์„ ์ •ํ•ด์ฃผ๋Š” ์—ญํ• ์„ ํ•˜๊ฒŒ ๋œ๋‹ค. ๋˜ํ•œ @main์„ ํ†ตํ•˜์—ฌ ์•ฑ์ด ์‹œ์ž‘๋˜๊ณ  ๊ฐ€์žฅ ๋จผ์ € ๋“ค์–ด๊ฐ€์•ผํ•˜๋Š” ๋ถ€๋ถ„์„ ๋ช…์‹œํ•ด์ฃผ๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— AppDelegate๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์•ฑ์˜ ์ดˆ๊ธฐํ™” ์ด์™ธ์—๋„ AppDele..