swift
[iOS] Firebase Cloud Messaging - APN
๊ธฐ๋ก์ฉ 1. firebase project ๋ง๋ค๊ธฐ https://console.firebase.google.com/u/3/?hl=ko 2. iOS ์ฑ ์ถ๊ฐํ๊ธฐ iOS๋ฅผ ๋๋ฌ ์ฑ์ ์ถ๊ฐํฉ๋๋ค ๊ทธ๋ฌ๋ฉด ์ฑ ๋ฑ๋ก ํ๋ฉด์ด ๋์ค๋๋ฐ ์ด๋ Apple ๋ฒ๋ค ID๋ฅผ ์ ๋ ฅํด์ผ ํจ ์๊ฑด ์ด๋ ๊ฒ์ด๋๋ฉด ์ค๋ฅธ์ชฝ ์์ค์ฝ๋ ์ฐฝ์์!! Signing & Capabilities ์์ ์๋ Bundle Identifier ์ ๋๋ค ๋๋จธ์ง ์ฑ ๋๋ค์, App Store ID๋ ์ ํ์ฌํญ์ด๋ ํจ์คํ ๊ฒ์ ๊ทธ๋ฌ๋ฉด 2๋ฒ ๋จ๊ณ ๊ตฌ์ฑ ํ์ผ ๋ค์ด๋ก๋๊ฐ ๋์ค๊ณ , GoogleService-Info.plist ๋ค์ด๋ก๋ ๋ฐ์์ Xcode ํ๋ก์ ํธ ์์ ์ถ๊ฐํด ์ฃผ์ธ์ ์ ๋ ์ ์ฌ์ง์ฒ๋ผ Plists๋ผ๋ ํด๋๋ฅผ ๋ฐ๋ก ๋ง๋ค์ด ์ฌ๊ธฐ์ Info.plist์ ํจ๊ป ๋ฃ์ด ๋..
[RxSwift] ARC, ๊ฐํ ์ฐธ์กฐ strong, ์ฝํ ์ฐธ์กฐ weak, ๊ฐํ ์ฐธ์กฐ ์ํ ๋ฌธ์
Struct vs Class Struct ํ์ ๊ณผ Class ํ์ ์ ๋น๊ตํ ๋ ๊ฐ์ฅ ๋ง์ด ํ๋ ๋ง → Struct๋ ๊ฐ ํ์ , Class๋ ์ฐธ์กฐ ํ์ ! ๊ฐ ํ์ : ์ ๋ฌํ ๋๋ง๋ค ๊ฐ์ ๋ณต์ฌํด์ ์ ๋ฌ ์ฐธ์กฐ ํ์ : ํ๋์ ์ธ์คํด์ค๊ฐ ์ฐธ์กฐ๋ฅผ ํตํด ์ฌ๋ฌ ๊ณณ์์ ์ ๊ทผ ์ธ์คํด์ค๊ฐ ์ ์ ํ ์์ ์ ๋ฉ๋ชจ๋ฆฌ์์ ํด์ ๋์ง ์์ผ๋ฉด ๋ฉ๋ชจ๋ฆฌ ์์์ ๋ญ๋นํ๊ฒ ๋จ. → ์ค์ํํธ์์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ์ ๊ด๋ฆฌํ๊ธฐ ์ํด ARC๋ฅผ ์ฌ์ฉ! ARC์ ์๋ ๊ท์น์ ๋ชจ๋ฅด๊ณ ์ฌ์ฉํ๋ฉด ์ธ์คํด์ค๊ฐ ๋ฉ๋ชจ๋ฆฌ์์ ์์ํ ํด์ ๋์ง ์์ ๊ฐ๋ฅ์ฑ์ด ์๊ธฐ ๋๋ฌธ์... ARC์ ๋ํด ์์์ผ ํ๋ค. ARC * ์๋ ์ฐธ์กฐ ์นด์ดํ , Automatic Reference Counting => ์๋์ผ๋ก ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ด๋ฆฌํด ์ฃผ๋ ๋ฐฉ์ * ๋ ์ด์ ํ์ํ์ง ์์ ํด๋์ค์ ์ธ์คํด์ค๋ฅผ ๋ฉ๋ชจ๋ฆฌ์์..
[RxSwift] ์ด๊ฒ ๋ง๋? ์ถ์ RxSwift ๊ฐ๋ ์ ๋ฆฌ
๊ณฐํ๊น ๋์ RxSwift 4์๊ฐ์ ๋๋ด๊ธฐ (์ข ํฉํธ) ์์์ ๋ณด๊ณ ์์ฑํ ๊ธ์ ๋๋ค ^~^ https://youtu.be/w5Qmie-GbiA ์ ๋ง ์์ด๋ณด,, ์๋ฌด๊ฒ๋ ๋ชจ๋ฅด๋ ์ ์ฅ์์ ๊ฐ์ ์์์ ๋ณด๊ณ ์์์ ํ๋ฆ๋๋ก ์์ฑํ ๊ธ์ด๋ ๋นํ์ ๋์ผ๋ก ๊ธ์ ์ฝ์ด ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค~~ ์ค๋ฅ ์ง์ ๋ํ์! [1๊ต์] ๊ฐ๋ ์ก๊ธฐ - RxSwift๋ฅผ ์ฌ์ฉํ ๋น๋๊ธฐ ํ๋ก๊ทธ๋๋ฐ โ๏ธ Rx์ ๋ชฉ์ ๋น๋๊ธฐ์ ์ผ๋ก ๋ง๋ค์ด์ง๋ ๋ฐ์ดํฐ(์ธ์ ๋ง๋ค์ด์ง์ง ๋ชจ๋ฆ)๋ฅผ completion์ผ๋ก ์ ๋ฌํ๋ ๊ฒ ์๋๋ผ ๋ฆฌํด ๊ฐ์ผ๋ก ์ ๋ฌํ์ฌ ์ข ๋ ๊ฐ๊ฒฐํ๊ฒ ์ฌ์ฉํ๋๋ก ๋ง๋ค์ด์ง ์ ํธ๋ฆฌํฐ ์๊ฐ์ด ๊ฑธ๋ฆฌ๋ ์์ ๋์ค ์ทจ์ ์ ์ ์ฉ ๋๊ธฐ/๋น๋๊ธฐ ์ฒ๋ฆฌ ์ฝ๊ณ ๊ฐ๋จํ๊ฒ create, subscribe, disposable // MARK: RxSwift ์ํ ์ฌ์ฉ..
[Swift] ํ์ ์บ์คํ , ๋ค์ด์บ์คํ , is, as๋?
Swift์ ํ์ ์บ์คํ ์ ๋ํด ์์๋ณด์์. ๐ ๋จผ์ ํด๋์ค์ ์์ ๊ฐ๋ ๋ถํฐ ์ดํดํ๊ณ ์์ด์ผ ํ๋๋ฐ...... ์ด๋ ๊ฒ Coffee, Latte, Americano๋ผ๋ ํด๋์ค๊ฐ ์์ต๋๋ค. ์ฌ๊ธฐ์ ์ฐ๋ฆฌ๋ ๋ผ๋ผ์ ์๋ฉ๋ฆฌ์นด๋ ธ๋ฅผ ๋ฌถ์ด์ ์ปคํผ๋ผ๊ณ ๋ถ๋ฅด๊ธฐ๋ ํ์ฃ !??!? ์ปคํผ๋ผ๋ ๊ฐ๋ ์ ํฌํจํ๊ณ ์๋ ๋ผ๋ผ๋, ์ฌ๊ธฐ์์๋ ์ปคํผ๋ฅผ ์์๋ฐ์ ๋ผ๋ผ๊ฐ ํ์ํ๊ฒ ๋ฉ๋๋ค! ๋ง์ฐฌ๊ฐ์ง๋ก ์ปคํผ๋ผ๋ ๊ฐ๋ ์ ํฌํจํ๊ณ ์๋ ์๋ฉ๋ฆฌ์นด๋ ธ๋ ์์ฑ! ๊ทธ๋ฌ๋ฉด ์ปคํผ๋ ๋ถ๋ชจ Class, ๋ผ๋ผ์ ์๋ฉ๋ฆฌ์นด๋ ธ๋ ์์ Class๊ฐ ๋จ๋๋ค. '์ปคํผ'๋ '์ท'์ด๋ผ๋ ํญ๋ชฉ์ ๊ฐ๊ณ ์๊ณ , ์ด๋ฅผ ์์๋ฐ์ ์์๋ค์ธ ๋ผ๋ผ์ ์๋ฉ๋ฆฌ์นด๋ ธ๋ '์ท'์ด๋ผ๋ ํญ๋ชฉ์ ๊ฐ์ง๊ณ ์์ด๋๋ค~~ ์ด๊ฐ๋จ ์์ ๋! class Coffee { let shot: Int init(shot: Int) ..
[UIKit] UIButton Custom Design ์ ์ฉ
๋ถ์ : ์์ ๋ฒํผ ๋ง๋ค๊ธฐ phoneNumDoneBtn.backgroundColor = .gray phoneNumDoneBtn.layer.cornerRadius = 4 phoneNumDoneBtn.setTitleColor(.white, for: .normal) ์ ์ฉํ๋ฉด ์ด๋ฐ ๋๋!
[UIKit] UITableView ๋น ์ ์จ๊ธฐ๊ธฐ
tableView.tableFooterView = UIView(frame: CGRect.zero) ๊ทธ๋ฅ UIView ํ๋ ๋์ด๋ค ์คํ ๋ฆฌ๋ณด๋์ ๋์๋ ๋์ง๋ง ์ฝ๋ ํ ์ค์ด ๋ ํธํ๊ธธ๋~~~~
[PagingKit] Could not load NIB in bundle error ํด๊ฒฐ
PagingKit GitHub - kazuhiro4949/PagingKit: PagingKit provides customizable menu UI. It has more flexible layout and design than the other PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries. - GitHub - kazuhiro4949/PagingKit: PagingKit provides customizable menu UI. It has more fl... github.com ํ์ด์ง ํคํธ๋ฅผ ์ด์ฉํด ๋ทฐ๋ฅผ ๋ง๋ ํ, ๋ค๋ฅธ ๋ทฐ์๋ ํ์ด์ง ํคํธ๊ฐ ํ์ํด์ ๊ธฐ์กด ํ์ผ๋ค์ ..
[Swift] ๋ ์ง๋ฅผ ๋ฌธ์๋ก! Date to String
func dateToString(_ today: Date) -> String{ let year = Calendar.current.component(.year, from: today) let month = Calendar.current.component(.month, from: today) let day = Calendar.current.component(.day, from: today) let weekdayInt = Calendar.current.component(.weekday, from: today) var weekday: String = "" switch weekdayInt { case 1: weekday = "SUN" case 2: weekday = "MON" case 3: weekday = "T..
[๋คํธ์ํน] iOS Swift Alamofire ์์ฒญ/์๋ตํ๊ธฐ(form-dataํ์)
์ฐ๋ฆฌ ์๋ฒ์ json ํ์์ผ๋ก ํฐ๋ฒํธ ๋๊ฒผ๋๋ ์๊พธ ๋ณ์ ๋ถ์กฑ ์๋ฌ ์ฝ๋ ๋ธ -> ์๋ฒํ์ ๋ฌผ์ด๋ด -> ์๋ฒ์ ๋ฐ์ดํฐ ๋ณด๋ผ ๋ json ๋ง๊ณ form-data ํ์์ผ๋ก ๋ณด๋ด ๋ฌ๋ผ๊ณ ํจ -> ๊ทธ๋ฐ๋ฐ Alamofire์ form-data ํ์์ผ๋ก ์ ๋ก๋ํ ์ ์๋ ๋ฉ์๋๊ฐ ์์๋ค!!!! ํ์ ํ๋ ๊ฒ์ฒ๋ผ(line 8์ ์ฃผ์ ์ฒ๋ฆฌํ ๋ถ๋ถ) request๋ฅผ ๋ณด๋ด๋ ๋ฉ์๋๊ฐ ์๋๋ผ, ์๋ฒ์ ์ ๋ก๋ํ๋ ๊ฐ๋ ์ธ ๋ฏ. ์๋ฌดํผ multipartFormData ํ์ฉํด์ ํด๋ํฐ ๋ฒํธ ๋ฃ์๋๋ ์ ๋๋ก ์์ฒญ์ด ์ ์ก๋๋ค. ๐ฅบ //MARK: SMS request // API ํธ์ถ let paramForSMS:Parameters = ["userphonenum": phoneField.text] let url = "์ฌ๊ธฐ์ url ์ฃผ์ ..
[UIKit] ๊ฐ๋จํ toast message, ํ์ธ ๋ฒํผ๋ง ์๋ alert ์์
extension UIViewController { func alert(_ message: String, completion: (()->Void)? = nil) { DispatchQueue.main.async { let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert) let okAction = UIAlertAction(title: "ํ์ธ", style: .cancel) { (_) in completion?() } alert.addAction(okAction) self.present(alert, animated: false) } } } ์ฌ์ฉํ ๋์๋ ์๋ฌด๋ฐ์๋ self.alert("์๋ฆผ๋ฉ์์ง!!!") ์ด๋ ๊ฒ ์ฌ์ฉ..
[๋ชจ๋์ ์๊ณ ๋ฆฌ์ฆ] 1๋ถํฐ n๊น์ง์ ํฉ ๊ตฌํ๊ธฐ(python, Swift)
์ฐธ๊ณ ๊ต์ฌ: ๋ชจ๋์ ์๊ณ ๋ฆฌ์ฆ with ํ์ด์ฌ โ ๋ฌธ์ 1๋ถํฐ n๊น์ง ์ฐ์ํ ์ซ์์ ํฉ ๊ตฌํ๊ธฐ ์ ๋ ฅ: n ์ถ๋ ฅ: ์ ์๐ ๊ธฐ์กด ํ์ด python def sum_1ton(n): total = 0 for i in range(1, n+1): total += i return totalSwift5 public func sum_1ton(n: Int) -> Int { var sum:Int = 0 for i in 1.. Int { return (n * (n + 1)) / 2 }โ๏ธ ์ฐ์ต๋ฌธ์ // ์ฐ์ต๋ฌธ์ 1-1 public func sumPow_1toN(n: Int) -> Int { var sum = 0 for i in 0...n { sum += Int(pow(Double(i), 2.0)) } return sum } //..