๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

๐Ÿ“ฑMobile/๐Ÿ”ฅSwift8

[Swift] SwiftUI Push Notifications(FCM) APN(APNS) ํ‘ธ์‰ฌ์•Œ๋ฆผ ์˜ˆ์ œ Firebase Cloud Messaging/Google Cloud Messaging(FMC/GCM) Google Cloud Messaging(GCM)์ด Firebase Cloud Messaging(FCM)์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค. 2021๋…„๋ถ€ํ„ฐ ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Android, iOS ๋ฐ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์šฉ ๋ฉ”์‹œ์ง€ ๋ฐ ์•Œ๋ฆผ์„ ์œ„ํ•œ ํฌ๋กœ์Šค ํ”Œ๋žซํผ ํด๋ผ์šฐ๋“œ ์†”๋ฃจ์…˜ APN/APNS(Apple Push Notification/Apple Push Notification Service) ํƒ€์‚ฌ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœ์ž๊ฐ€ Apple ์žฅ์น˜์— ์„ค์น˜๋œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ์•Œ๋ฆผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋„๋ก Apple ์—์„œ ๋งŒ๋“  ํ”Œ๋žซํผ ์•Œ๋ฆผ์„œ๋น„์Šค APNs์—์„œ ๋””๋ฐ”์ด์Šค๋กœ ๋ณด๋‚ด๊ธฐ ์›ํ•˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›๊ณ , ์ด๊ณณ์—์„œ ๋ฉ”์‹œ์ง€์˜ ์‹ ๋ขฐ๋„๋ฅผ ๊ฒ€์‚ฌํ•ด์„œ d.. 2023. 7. 9.
[Swift] SwiftUI Infinite ScrollView ๋ฌดํ•œ์Šคํฌ๋กค๋ทฐ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€๋กœ๋“œ trainingApp.swift import SwiftUI @main struct trainingApp: App { var body: some Scene { WindowGroup { ContentView() } } } ContentView.swift import SwiftUI struct ContentView: View { @State var current: Int = 0 @State var maxCnt: Int = 0 @State var itemList: [ItemModel] = [] @State var hasMorePages:Bool = true var body: some View { GeometryReader { geometry in let columns: [GridItem] = [GridItem(.. 2021. 11. 1.
[Swift] SwiftUI TabView(bottom navigation bar) + SideMenubar ์˜ˆ์ œ trainingApp.swift import SwiftUI @main struct trainingApp: App { var body: some Scene { WindowGroup { ContentView() } } } ContentView.swift import SwiftUI struct ContentView: View { @State var showMenu = false var body: some View { ZStack{ GeometryReader { geometry in let width = geometry.size.width let height = geometry.size.height if self.showMenu { MenuView() .frame(width: width / 1.5) .trans.. 2021. 11. 1.
[Swift] SwiftUI KeyChain Service ์˜ˆ์ œ KeyChain Services ํ‚ค์ฒด์ธ ์„œ๋น„์Šค๋ž€? ์‚ฌ์šฉ์ž๋ฅผ ๋Œ€์‹ ํ•˜์—ฌ ์†Œ๋Ÿ‰์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์‚ฌ๋žŒ๋“ค์€ ์ˆ˜๋งŽ์€ ์˜จ๋ผ์ธ ๊ณ„์ •์„ ๊ด€๋ฆฌํ•˜๊ณ , ์ผ๋ฐ˜์ ์œผ๋กœ ์—ฌ๋Ÿฌ ๊ณ„์ •์— ๊ฑธ์ณ ๊ฐ„๋‹จํ•œ ์•”ํ˜ธ๋ฅผ ์žฌํ™œ์šฉํ•˜๊ธฐ์— ์•ˆ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด์— ๋Œ€์‘ํ•˜์—ฌ ํ‚ค์ฒด์ธ ์„œ๋น„์Šค API๋Š” ์•ฑ์— ํ‚ค์ฒด์ธ์ด๋ผ๋Š” ์•”ํ˜ธํ™”๋œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ์˜ ์ž‘์€ ๋น„ํŠธ๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ์ œ๊ณตํ•˜์—ฌ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š”๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์•ˆ์ „ํ•˜๊ฒŒ ๊ธฐ์–ต๋˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๋ณต์žกํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž์œ ๋กญ๊ฒŒ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋น„๋ฐ€๋ฒˆํ˜ธ์— ๊ตญํ•œ๋˜์ง€ ์•Š๊ณ  ์ธ์ฆ์„œ, ํ‚ค ๋ฐ ์‹ ๋ขฐ ์„œ๋น„์Šค๋กœ ๊ด€๋ฆฌํ•˜๋Š” ์•”ํ˜ธํ™” ํ‚ค ๋ฐ ์ธ์ฆ์„œ๋„ ๋ณด๊ด€์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ ์ด๊ฒƒ๋“ค๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž๋Š” ๋ณด์•ˆ ํ†ต์‹ ์— ์ฐธ์—ฌํ•˜๊ณ  ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž ๋ฐ ์žฅ์น˜์™€ ์‹ ๋ขฐ๋ฅผ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. API Com.. 2021. 10. 30.
[Swift] SwiftUI WebView, WebView + javascript message handler ์˜ˆ์ œ ์•ฑ์˜ ์ข…๋ฅ˜์— ๋”ฐ๋ผ์„œ ํ•„์š”์‹œ ์›น ๋ทฐ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์•ฑ๋“ค์ด ์žˆ๋‹ค. ๋‹จ์ˆœํžˆ ๋ณด์—ฌ์ฃผ๋Š” ์šฉ๋„๋„ ๊ฐ€๋Šฅํ•˜๋‚˜ ํ•˜์ด๋ธŒ๋ฆฌ๋“œ ์•ฑ์€ ์›น๊ณผ ์•ฑ์ด ์„œ๋กœ ์ƒํ˜ธ์ž‘์šฉํ•˜๋„๋ก ๊ตฌํ˜„์„ ๋งŽ์ดํ•˜๋Š”๋ฐ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž๋Š” ์›นํ™”๋ฉด์„ ๋ณด๊ณ ์žˆ๋Š”์ง€ ๋ชจ๋ฅด๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋Š๋‚„ ์ˆ˜ ์žˆ๋‹ค. ๋‹จ์ˆœํžˆ ๋ณด์—ฌ์ฃผ๊ธฐ๋งŒ ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์„œ๋กœ ์ƒํ˜ธ์ž‘์šฉ ํ•  ์ˆ˜๋„ ํ•  ์ˆ˜ ์žˆ๋‹ค. 1. WebView WebView.swift import SwiftUI import WebKit struct WebView: UIViewRepresentable { var url: String func makeUIView(context: Context) -> WKWebView { guard let url = URL(string: self.url) else { return WKWebView() } let webView .. 2021. 9. 28.
[Swift] SwiftUI SHA256์„ ์ด์šฉํ•œ ๊ฐ„๋‹จํ•œ ๋กœ๊ทธ์ธ ๊ตฌํ˜„ ์˜ˆ์ œ SHA256์„ ์‚ฌ์šฉํ•˜์—ฌ password๋ผ๋Š” ๋ฌธ์ž์—ด์˜ ํ•ด์‰ฌ๊ฐ’์„ ๋งŒ๋“ ๋‹ค. ํšŒ์›๊ฐ€์ž… ์ ˆ์ฐจ๋Š” ์—†์Œ์œผ๋กœ id๋Š” "kim" ๊ณ ์ •์ด๊ณ  password๋Š” "password" ์œผ๋กœ ๊ณ ์ • ContentView.swift import SwiftUI import CryptoKit struct FieldStyle: ViewModifier { let lightGreyColor = Color(red: 240.0/255.0, green: 240.0/255.0, blue: 240.0/255.0, opacity: 1.0) func body(content: Content) -> some View { return content .padding() .background(lightGreyColor) .cornerRadius(5.0) .padd.. 2021. 9. 28.
[Swift] SwiftUI/StoryBoard LaunchScreen + Sleep ์˜ˆ์ œ ๋Ÿฐ์น˜ ํ™”๋ฉด / ์Šคํ”Œ๋ž˜์‹œ ํ™”๋ฉด์€ ์‚ฌ์šฉ์ž๊ฐ€ ์ œ์ผ ์ฒ˜์Œ ๋งˆ์ฃผํ•˜๋Š” ํ™”๋ฉด์ด๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ๋ฉ”์ธํ™”๋ฉด์„ ๋ณด๊ธฐ์ „์— ํ•˜์–€ ๋นˆ ํ™”๋ฉด์„ ๋งˆ์ฃผํ•˜๊ฒŒ๋œ๋‹ค๋ฉด ํ˜„์žฌ ์‚ฌ์šฉํ•˜๋Š” ์•ฑ์ด ๋ฐ˜์‘์„ฑ์ด ์ข‹์ง€์•Š๋‹ค๋Š” ์ธ์‹์„ ํ•ด์ค„ ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด์œ  ๋•Œ๋ฌธ์— ๋Ÿฐ์น˜ ํ™”๋ฉด์„ ๋งŒ๋“ค์–ด์„œ ์•ฑ์ด ์‹คํ–‰๋˜์ž ๋งˆ์ž ๋งˆ์ฃผํ•  ์ˆ˜ ์žˆ๋Š” ํ™”๋ฉด์„ ๋งŒ๋“ค์–ด์•ผํ•œ๋‹ค. ๋Ÿฐ์น˜ ํ™”๋ฉด์—์„œ๋Š” ๋ณดํ†ต ํด๋ผ์ด์–ธํŠธ์—์„œ ์ดˆ๊ธฐ์— ์ฒ˜๋ฆฌํ•ด์•ผ๋  ์ž‘์—…์ด ์žˆ๊ฑฐ๋‚˜, ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ž‘์—…, ๋ถˆ๋Ÿฌ์˜ค๊ณ  ์ฒ˜๋ฆฌํ•˜๋Š” ๊ณผ์ •๋“ค์ด ์žˆ์„ ์ˆ˜ ์žˆ๋Š”๋ฐ ์ด๋Ÿฌํ•œ ์ž‘์—…์„ ํ•˜๋Š” ๋™์•ˆ์— ์œ ์ €์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†๋Š” ์ƒํƒœ์—์„œ ๋ฉ”์ธํ™”๋ฉด์œผ๋กœ ๋„˜์–ด๊ฐ€์ง€ ์•Š๋„๋ก ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ณ ์ •ํ™”๋ฉด๋งŒ ๋ณด์—ฌ์ค„ ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ƒํƒœ๋ฅผ ๋ณ€ํ™˜ํ•˜์—ฌ ํ‘œ์‹œํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ•์€ ์ฐพ์ง€ ๋ชปํ•˜์˜€๋‹ค. ์—†๋‹ค๋Š” ์–˜๊ธฐ๋„ ์žˆ๋Š”๊ฒƒ ๊ฐ™์€๋ฐ ํ™•์‹ค์น˜๋Š” ์•Š๋‹ค. LaunchScreen๊ณผ Splash ๋‘ ๊ฐ€์ง€๊ฐ€ .. 2021. 9. 27.
[Swift] Optional ๊ฐœ๋…์ •๋ฆฌ (๋ณ€์ˆ˜๋’ค์— !์™€ ?) optional ์˜ˆ์ œ Optional ๊ฐœ๋…์ •๋ฆฌ ์„ ํƒ์ ์ธ ์ด๋ผ๋Š” ๋œป์„๊ฐ€์ง„ optional ์€ swift์—์„œ ๋ฌด์—‡์ผ๊นŒ์š”? ๋งŒ์•ฝ ์น˜ํ‚จ์„ ๋ฐฐ๋‹ฌ์‹œํ‚ค๋Š” ์ƒํ™ฉ์„ ์ƒ๊ฐํ•ด๋ณผ๊นŒ์š”? ์ผ๋‹จ ์ฝ์–ด๋ณผ๊ฒŒ์š”! ๋ฐฐ๋‹ฌ์–ดํ”Œ์—์„œ XCODE๋ผ๋Š” ์น˜ํ‚จ ๊ฐ€๊ฒŒ๋ฅผ ํด๋ฆญํ•˜๊ณ  ์น˜ํ‚จ ๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. [์ฝ”๋“œ์ž‘์„ฑ์ค‘] ์•„์ง์€ ๋ง› ์˜ต์…˜์„ ๊ณ ๋ฅด์ง€ ์•Š์€ ์ƒํƒœ์—ฌ์„œ ๋ง›์€ ์ตœ์†Œ 1๊ฐœ๋ฅผ ๊ณจ๋ผ์ฃผ์„ธ์š”! ๋ผ๋Š” ๊ฒฝ๊ณ ๋ฌธ๊ตฌ๊ฐ€ ๋ณด์ž…๋‹ˆ๋‹ค! [nil ๊ฒฝ๊ณ ] ํ•˜์ง€๋งŒ ๋ง› ์˜ต์…˜์„ ๊ณ ๋ฅด์ง€ ์•Š์•„๋„ ์ฃผ๋ฌธ์€ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๋ง›์˜ต์…˜์„ ๊ณ ๋ฅด์ง€ ์•Š์œผ๋ฉด ๊ฐ€๊ฒŒ์—์„œ๋Š” ์–ด๋–ค ๋ง›์œผ๋กœ ์ค„๊นŒ? ํ˜ธ๊ธฐ์‹ฌ์— ์•„๋ฌด๋ง›๋„ ๊ณ ๋ฅด์ง€ ์•Š๊ณ  ์ฃผ๋ฌธ์„ ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. [nil ๊ฒฝ๊ณ ๋ฅผ ๋ณด์•˜์ง€๋งŒ ์‹คํ–‰] ์ฃผ๋ฌธ์„œ๊ฐ€ ๊ฐ€๊ฒŒ๋กœ ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค. [์ปดํŒŒ์ผ] ๊ฐ€๊ฒŒ๋Š” ์ฃผ๋ฌธ์„ ๋ฐ›์•˜๊ณ  ์ฃผ๋ฌธ์„œ๋ฅผ ์ฝ๊ณ  ์ˆœ์„œ๋Œ€๋กœ ์กฐ๋ฆฌ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค. [Application ์‹คํ–‰๋จ] ์ˆœ์„œ๋Œ€๋กœ ์กฐ๋ฆฌํ•˜.. 2020. 12. 16.
๋ฐ˜์‘ํ˜•