728x90

๐Ÿ“ฑ App Development Study/iOS๐ŸŽ 57

[Udemy iOS & Swift Bootcamp] ์ฑ„ํŒ… ์™„์„ฑํ•˜๊ธฐ 2 (์ตœ์‹  ๋ฉ”์„ธ์ง€(๋งจ ์•„๋ž˜)์œผ๋กœ ํ™”๋ฉด ์Šคํฌ๋กคํ•˜๊ธฐ.)

2. ์ตœ์‹  ๋ฉ”์„ธ์ง€(๋งจ ์•„๋ž˜)์œผ๋กœ ํ™”๋ฉด ์Šคํฌ๋กคํ•˜๊ธฐ. ์ฑ„ํŒ…์„ ์ž‘์„ฑํ–ˆ์„ ๋•Œ, ํ™”๋ฉด ์Šคํฌ๋กค์„ ๋งจ ์•„๋ž˜๋กœ ๋‚ด๋ ค์„œ ์ตœ์‹  ๋ฉ”์„ธ์ง€๋ฅผ ๋ณด์—ฌ์ค˜์•ผ ํ•œ๋‹ค. tableView ์—์„œ ํŠน์ • ์…€๋กœ ์Šคํฌ๋กค ํ•˜๋Š” ํ•จ์ˆ˜๋Š” scrollToRow ํ•จ์ˆ˜ ์ด๋‹ค. ํŠน์ •์…€ ์ธ๋ฑ์Šค์ธ indexPath, ์Šคํฌ๋กค ํฌ์ง€์…˜(top, bottom, middle), ์Šคํฌ๋กค ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ true or false ์ธ์ž๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค. func loadMessages(){ db.collection(K.FStore.collectionName).order(by: K.FStore.dateField).addSnapshotListener { (querySnapshot, err) in self.messages = [] if let e = err { print("Error ge..

[Udemy iOS & Swift Bootcamp] ์ฑ„ํŒ… ์™„์„ฑํ•˜๊ธฐ 1 (๋ฐœ์‹ ์ž/์ˆ˜์‹ ์ž ๊ตฌ๋ถ„ํ•˜๊ธฐ)

์ง€๊ธˆ๊นŒ์ง€ ๋งŒ๋“  ์ฑ„ํŒ…์•ฑ์—์„œ ๋ถ€์กฑํ•œ 3๊ฐ€์ง€๋ฅผ ์ฑ„์›Œ๋ณด์ž. 1. ๋ฐœ์‹ ์ž/์ˆ˜์‹ ์ž ๊ตฌ๋ถ„ํ•˜๊ธฐ 2. ์ตœ์‹  ๋ฉ”์„ธ์ง€(๋งจ ์•„๋ž˜)์œผ๋กœ ํ™”๋ฉด ์Šคํฌ๋กคํ•˜๊ธฐ. 3. ์ƒ๋‹จ ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ” ๊พธ๋ฏธ๊ธฐ 1. ๋ฐœ์‹ ์ž/์ˆ˜์‹ ์ž ๊ตฌ๋ถ„ํ•˜๊ธฐ 1) ๊ธฐ์กด์— ๋งŒ๋“ค์—ˆ๋˜ Cell ์— another user ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ํ•˜๊ธฐ. ์™ผ์ชฝ์˜ ๊ธฐ์กด Cell ์— right Image ๋ฅผ ๋ณต์‚ฌํ•ด์„œ ์™ผ์ชฝ์— ๋ถ™์—ฌ๋„ฃ๊ณ  You ์ด๋ฏธ์ง€๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค. ์ฑ„ํŒ… ๋ฉ”์„ธ์ง€๊ฐ€ ๋ณธ์ธ์ด๋ฉด Me, ์ƒ๋Œ€๋ฐฉ์ด๋ฉด You ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๊ฒŒ ํ•  ๊ฒƒ์ด๋‹ค. 2) MessageCell ์Šคํฌ๋ฆฝํŠธ์— leftImageView ๊ฐ์ฒด ์ถ”๊ฐ€ํ•˜๊ธฐ. ์ด๋ฏธ์ง€ ๊ฐ์ฒด๋ฅผ ์ƒํ™ฉ์— ๋งž๊ฒŒ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋„๋ก ๊ฐ์ฒด๋กœ ์ถ”๊ฐ€ํ•ด์ฃผ์ž. 3) ChatViewController ํด๋ž˜์Šค์— ์ฝ”๋“œ ์ถ”๊ฐ€ํ•˜๊ธฐ extension ChatViewController: UITa..

[Udemy iOS & Swift Bootcamp] Keyboard ๋‹ค๋ฃจ๊ธฐ

์ฑ„ํŒ… ๊ธฐ๋Šฅ ๊ตฌํ˜„ ์ค‘, ํ‚ค๋ณด๋“œ๊ฐ€ ์ž…๋ ฅ์ฐฝ์„ ๊ฐ€๋ฆฌ๋Š” ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. ํ‚ค๋ณด๋“œ๊ฐ€ ์œ„๋กœ ์˜ฌ๋ผ์˜ฌ ๋•Œ, ์ž…๋ ฅ์ฐฝ๋„ ํ•จ๊ป˜ ์˜ฌ๋ผ์™€์•ผ ์‚ฌ์šฉ์ž๊ฐ€ ๋ถˆํŽธํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค. ์ด ๋ฌธ์ œ์™€ ๊ด€๋ จ๋œ ์ข‹์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์žˆ๋‹ค. ๋ฐ”๋กœ IQKeyboardManagerSwift. https://cocoapods.org/pods/IQKeyboardManagerSwift IQKeyboardManagerSwift Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. cocoapods.org 1. IQKeyboardManagerSwift ์„ค์น˜ํ•˜๊ธฐ Podfile ์— pod 'IQKeyboardManag..

[Udemy iOS & Swift Bootcamp] Firebase's Cloud Firestore

* Cloud Firestore: ๋ชจ๋ฐ”์ผ ์•ฑ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ Firebase์˜ ์ตœ์‹  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค. Firestore | Firebase ์œ ์—ฐํ•˜๊ณ  ํ™•์žฅ ๊ฐ€๋Šฅํ•œ NoSQL ํด๋ผ์šฐ๋“œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•ด ํด๋ผ์ด์–ธํŠธ ์ธก ๊ฐœ๋ฐœ ๋ฐ ์„œ๋ฒ„ ์ธก ๊ฐœ๋ฐœ์— ์‚ฌ์šฉ๋˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ๋™๊ธฐํ™”ํ•˜์„ธ์š”. firebase.google.com Firebase์— 2๊ฐ€์ง€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ์žˆ๋‹ค. ๊ธฐ์กด firebase ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์ธ Realtime Database, ๋ชจ๋ฐ”์ผ ์•ฑ ๊ฐœ๋ฐœ์„ ์œ„ํ•ด ์—…๋ฐ์ดํŠธ๋œ Cloud Firestore. ๊ธฐ์กด firebase์— ์ฟผ๋ฆฌ๋‚˜ MongoDB ๊ฐ™์€ ํ˜„๋Œ€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์„ ์›ํ•ด์„œ ์—…๊ทธ๋ ˆ์ด๋“œ ๋˜์—ˆ๋‹ค๊ณ  ํ•œ๋‹ค. ๋” ์ž์„ธํ•œ ์ฐจ์ด๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค. [Cloud Firestore VS Realtime Databa..

[Udemy iOS & Swift Bootcamp] Type Casting

Type casting ์— ์‚ฌ์šฉ๋˜๋Š” ๊ตฌ๋ฌธ์„ ์•Œ์•„๋ณด์ž. is ๋ฐ์ดํ„ฐ ํƒ€์ž… ํ™•์ธ์šฉ let cell = UITableViewCell() if cell is UITableViewCell { print("The types match!") } as? ๋‹ค์šด์บ์ŠคํŒ…์„ ํ™•์ธํ•˜๊ณ  ๋ณ€ํ™˜ํ•˜๋Š” ๊ฒƒ. ์ฃผ๋กœ if ๋ฌธ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•จ. if let messageCell = cell as? MessageCell { //Then can use messageCell's capabilities } as! ๋ฐ์ดํ„ฐ ํƒ€์ž…์„ ์„œ๋ธŒ ํด๋ž˜์Šค๋กœ ๋ณ€ํ™˜ ๊ฐ•์ œ ๋‹ค์šด ์บ์ŠคํŒ…. Forced Downcast let messageCell = cell as! MessageCell as ํƒ€์ž…์„ ์Šˆํผ ํด๋ž˜์Šค๋กœ ๋ฐ”๊พธ๋Š”, ํ•ญ์ƒ ์˜ณ์€ Upcast let newCell = mes..

[Udemy iOS & Swift Bootcamp] Table View(DataSource, Delegate)

์ฑ„ํŒ… ์ฐฝ์—์„œ ์ฑ„ํŒ… ๋ฆฌ์ŠคํŠธ๋ฅผ ์ถœ๋ ฅํ•˜๊ธฐ ์œ„ํ•ด Table View ๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์ž. Table View๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ฟŒ๋ฆด DataSource์™€ ๋ฆฌ์ŠคํŠธ์— ์ด๋ฒคํŠธ๋ฅผ ๋ถ€์—ฌํ•  Delegate ํ”„๋กœํ† ์ฝœ์ด ํ•„์š”ํ•˜๋‹ค. 1) DataSource extension: table view์— index์— ๋งž์ถฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฟŒ๋ฆฌ๊ธฐ ์œ„ํ•จ 2) Delegate extension: table view ๋ฆฌ์ŠคํŠธ์˜ index์—์„œ ๊ฐ๊ฐ์— ์ด๋ฒคํŠธ๋ฅผ ๋ถ€์—ฌํ•˜๊ธฐ ์œ„ํ•จ 1. Table View ์ถ”๊ฐ€ View ์— Table View ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์ฝ”๋“œ์ƒ์—์„œ ์—ฐ๊ฒฐํ•œ๋‹ค. 2. table view ์˜ dataSource ์— self ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ€์—ฌํ•ด์ค€๋‹ค. IBOutlet ์œผ๋กœ UITableView๋ฅผ ์—ฐ๊ฒฐํ•ด์ค€๋‹ค. ๋˜ํ•œ, viewDidLoad() ํ•จ์ˆ˜ ๋‚ด์—์„œ ๋ทฐ๊ฐ€ ๋กœ๋“œ๋œ ํ›„..

[Udemy iOS & Swift Bootcamp] ๋ฌธ์ž์—ด์„ ์œ„ํ•œ ์ƒ์ˆ˜์ฝ”๋“œํŒŒ์ผ ๋งŒ๋“ค๊ธฐ

import UIKit import FirebaseAuth class RegisterViewController: UIViewController { @IBOutlet weak var emailTextfield: UITextField! @IBOutlet weak var passwordTextfield: UITextField! @IBAction func registerPressed(_ sender: UIButton) { if let email = emailTextfield.text, let password = passwordTextfield.text { Auth.auth().createUser(withEmail: email, password: password) { authResult, error in if l..

[Udemy iOS & Swift Bootcamp] 2. Firebase ์‚ฌ์šฉํ•˜๊ธฐ(ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ, ๋กœ๊ทธ์•„์›ƒ)

https://firebase.google.com/docs/ios/setup?hl=ko&authuser=0 Apple ํ”„๋กœ์ ํŠธ์— Firebase ์ถ”๊ฐ€ | Apple ํ”Œ๋žซํผ์šฉ Firebase Google I/O 2023์—์„œ Firebase์˜ ์ฃผ์š” ์†Œ์‹์„ ํ™•์ธํ•˜์„ธ์š”. ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ ์˜๊ฒฌ ๋ณด๋‚ด๊ธฐ Apple ํ”„๋กœ์ ํŠธ์— Firebase ์ถ”๊ฐ€ ์ปฌ๋ ‰์…˜์„ ์‚ฌ์šฉํ•ด ์ •๋ฆฌํ•˜๊ธฐ ๋‚ด ํ™˜๊ฒฝ์„ค์ •์„ ๊ธฐ์ค€์œผ๋กœ ์ฝ˜ํ…์ธ ๋ฅผ ์ €์žฅํ•˜๊ณ  ๋ถ„๋ฅ˜ํ•˜์„ธ์š” firebase.google.com 1. ๋กœ๊ทธ์ธ(๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฆ) ๊ตฌํ˜„ํ•˜๊ธฐ https://firebase.google.com/docs/auth/ios/password-auth?hl=ko&authuser=0 Apple ํ”Œ๋žซํผ์—์„œ ๋น„๋ฐ€๋ฒˆํ˜ธ ๊ธฐ๋ฐ˜ ๊ณ„์ •์œผ๋กœ Firebase์— ์ธ์ฆ | Firebase ์ธ์ฆ G..

[Udemy iOS & Swift Bootcamp] 1. Firebase ์ถ”๊ฐ€ํ•˜๊ธฐ

https://firebase.google.com/ Firebase Firebase is an app development platform that helps you build and grow apps and games users love. Backed by Google and trusted by millions of businesses around the world. firebase.google.com *Firebase: ํด๋ผ์šฐ๋“œ์— ๋ฐ์ดํ„ฐ ์ €์žฅ, ์‚ฌ์šฉ์ž ์ธ์ฆ ๋“ฑ์˜ ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ํ”Œ๋žซํผ 1. ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ 1 - 1) ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜๊ณ  ์ƒ์„ฑํ•ด์ค€๋‹ค. 2. ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์—์„œ ios ์•ฑ์„ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค. 3. ์•ฑ์„ ๋งŒ๋“ค ๋•Œ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด์ค€๋‹ค. Apple Bundle ID ๋Š” ํ”„๋กœ์ ํŠธ > T..

[Udemy iOS & Swift Bootcamp] 3rd Party Libraries & Cocoapods

*3rd Party Libraryies: ์™ธ๋ถ€ ์˜คํ”ˆ์†Œ์Šค ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค *Cocoapods: Xcode ์—์„œ Library๋“ค์„ ๊ด€๋ฆฌํ•˜๋Š” ๋„๊ตฌ. Cocoapods์— 95,000๊ฐœ ์ด์ƒ์˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์กด์žฌํ•œ๋‹ค. Xcode ์—์„œ๋Š” ๋‹ค์–‘ํ•œ ์™ธ๋ถ€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์„ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ Cocoapods ๋„๊ตฌ๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•œ๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‚˜์—ดํ•œ ํ›„ pod install ๊ตฌ๋ฌธ์œผ๋กœ ์ž๋™์„ค์น˜ํ•ด์ฃผ๊ณ , pod update ๊ตฌ๋ฌธ์„ ํ†ตํ•ด ์ž๋™์œผ๋กœ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์—…๋ฐ์ดํŠธํ•ด์ฃผ๋Š” ๋“ฑ ๊ด€๋ฆฌ๊ฐ€ ์šฉ์ดํ•˜๋‹ค. https://cocoapods.org/ CocoaPods.org CocoaPods is built with Ruby and is installable with the default Ruby available on macOS. We rec..

728x90