728x90

๐Ÿ“ฑ App Development Study 63

[Udemy iOS & Swift Bootcamp] Class vs Struct

struct vs class struct MyStruct { } class MyClass: SuperClass { } Immutable Passed by Value Passed by Reference Inheritance : ๊ธฐ๋ณธ์œผ๋ก  struct๋กœ ๋งŒ๋“œ๋Š”๊ฒŒ ๋งž๋‹ค. ์ƒ์†์„ ์›ํ•˜๋ฉด class ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ . * swift ๊ณต์‹๋ฌธ์„œ ์ฐธ๊ณ : https://docs.swift.org/swift-book/documentation/the-swift-programming-language/classesandstructures/ Documentation docs.swift.org

[Udemy iOS & Swift Bootcamp] Design Patterns - MVC ํŒจํ„ด

MVC(Model - View Controller) : ์ฝ”๋“œ๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๊ณ  ์š”์†Œ๋ฅผ ๋ถ„๋ฆฌํ•ด์„œ ๋ชจ๋“ˆ๋กœ ๋งŒ๋“œ๋Š”๋ฐ ์œ ์šฉํ•œ ๋ฐฉ๋ฒ•์ด๋‹ค. Model: data & Logic View: User Interface Controller: Mediator View ๋Š” Controller์™€๋งŒ ๋Œ€ํ™”ํ•œ๋‹ค. Controller๋Š” Model์—์„œ ๊ฐ’๋งŒ ๋ฐ›์•„์™€์„œ ๋ณด์—ฌ์ฃผ๊ธฐ๋งŒ ํ•œ๋‹ค. Model ์ด ๋ฐ์ดํ„ฐ์™€ ๋กœ์ง ๋ชจ๋‘๋ฅผ ๊ฐ–๊ณ  ์žˆ๋‹ค. ์–ด๋ ค์šด๊ฑด ๋‹ค ๋ชจ๋ธ์ด ํ•œ๋‹ค. Quizzler ์•ฑ ์ฝ”๋“œ๋ฅผ ์˜ˆ์‹œ๋กœ ๋“ค์–ด๋ณด์ž. ์™ผ์ชฝ์ƒ๋‹จ ์ ์ˆ˜, ๊ฐ€์˜จ๋ฐ ํ€ด์ฆˆ ๋ฌธ์ œ, ์•„๋ž˜ ๋ณด๊ธฐ 3๊ฐœ, ๋งจ ์•„๋ž˜ ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ”๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. ๊ฐ€์˜จ๋ฐ Text์—์„œ ๋ฌธ์ œ๊ฐ€ ๋‚˜์˜ค๊ณ  ์•„๋ž˜์— ๋ณด๊ธฐ 3๊ฐœ๊ฐ€ ๋‚˜์˜จ๋‹ค. ๋ณด๊ธฐ๋Š” ์ •๋‹ต์„ ํด๋ฆญํ•˜๋ฉด ์ดˆ๋ก์ƒ‰, ์˜ค๋‹ต์„ ํด๋ฆญํ•˜๋ฉด ๋นจ๊ฐ„์ƒ‰์œผ๋กœ ๋ณ€ํ•œ๋‹ค. ๋ฌธ์ œ๊ฐ€ ์ง„ํ–‰๋  ๋•Œ๋งˆ๋‹ค..

[Udemy iOS & Swift Bootcamp] Egg Timer ๋งŒ๋“ค๊ธฐ (feat. Timer, UIProgressView)

Udemy iOS & Swift Bootcamp 8๊ฐ• Egg Timer ๋งŒ๋“ค๊ธฐ์ด๋‹ค. soft, medium, hard ๊ณ„๋ž€์„ ๋งŒ๋“œ๋Š”๋ฐ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„์„ ํ™”๋ฉด์— ๋ณด์—ฌ์ฃผ๊ณ , 1์ดˆ๊ฐ€ ํ๋ฅผ ๋•Œ๋งˆ๋‹ค progress bar์— ์ง„ํ–‰์ƒํ™ฉ์„ ๋ณด์—ฌ์ฃผ๋Š” ๊ฒƒ์ด ๋ฉ”์ธ ๊ธฐ๋Šฅ์ด๋‹ค. ์‹ค๋กœํฐ ์•ฑ ๋งŒ๋“ค๊ธฐ์—์„œ ๋ฐฐ์› ๋˜ ๋งˆ์ง€๋ง‰ ์ข…๋ฃŒ ํšจ๊ณผ์Œ๋„! if/else๋ฌธ switch๋ฌธ, Dictionary, !? ํ‚ค์›Œ๋“œ, @objc ํ‚ค์›Œ๋“œ, Countdown Timer, UIProgressView ๋ฅผ ๋ฐฐ์› ๋‹ค. ๊ธฐ์–ตํ•˜๊ณ  ์‹ถ์€ ๋ถ€๋ถ„์€ Timer์ฝ”๋“œ์™€ UIProgressView์ด๋‹ค. 1. Timer ๊ธฐ๋Šฅ ๋งŒ๋“ค๊ธฐ //Timer ๊ธฐ๋Šฅ ํ•ต์‹ฌ์ฝ”๋“œ var countdownTimer: Timer! countdownTimer = Timer.scheduledTimer(time..

[Udemy iOS & Swift Bootcamp] Text Size ์ž๋™์กฐ์ ˆ, View Controller Scene Hierarchy

1. Text Size๋ฅผ ์งค๋ฆฌ์ง€ ์•Š๊ณ  ๋‹ค ๋‚˜์˜ค๋„๋ก ์ž๋™์กฐ์ ˆํ•˜๋Š” ๋ฒ• 2๊ฐ€์ง€. 1) Lines์˜ ์ˆ˜๋ฅผ 0์œผ๋กœ ๋งž์ถฐ์„œ ๋ฌด์ œํ•œ ๋ผ์ธ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜์ž Lines์˜ ์ˆ˜๋ฅผ ์ž„์˜์˜ ์ˆ˜๋กœ ์ฃผ๋ฉด ๋ผ์ธ ์ˆ˜๋ฅผ ์ œํ•œํ•ด์„œ ๊ธ€์ž๊ฐ€ ์ž˜๋ ค๋ณด์ผ ์ˆ˜ ์žˆ๋‹ค. Lines์˜ ์ˆ˜๋ฅผ 0์œผ๋กœ ์ฃผ๋ฉด ๋ฌธ์ž ๊ธธ์ด๊ฐ€ ๊ธธ์–ด์ง€๋ฉด ๊ธ€๊ผด ํฌ๊ธฐ๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ๋ผ์ธ ์ˆ˜๋ฅผ ๋Š˜๋ ค์„œ ๋‹ค ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋‹ค. 2) Autoshrink = Minimum Font Size Autoshrink ์†์„ฑ์„ Minimum Font Size ๋กœ ์ง€์ •ํ•ด์ฃผ์ž. ๊ณต๊ฐ„์— ๋งž์ถฐ ์ตœ์†Œ ํฐํŠธ ์‚ฌ์ด์ฆˆ๊นŒ์ง€ ํฐํŠธ ํฌ๊ธฐ๋ฅผ ์ตœ์†Œ ์‚ฌ์ด์ฆˆ๊นŒ์ง€ ์ž๋™์œผ๋กœ ์ค„์ธ๋‹ค๋Š” ๋œป์ด๋‹ค. 2. View Controller Scene Hierarchy ๊ธฐ์–ตํ•˜๊ธฐ. View Controller Scene์˜ ๋ˆˆ์€ ์•„๋ž˜์ชฝ์— ๋‹ฌ๋ ค์žˆ๋‹ค. ์ฆ‰ ์•„๋ž˜๊ฐ€..

[Udemy iOS & Swift Bootcamp] Button UIControl Event

๋ฒ„ํŠผ ๊ธฐ๋Šฅ ๊ตฌํ˜„์‹œ ํ•„์š”ํ•œ Event ํ•จ์ˆ˜๋“ค์„ ์ •๋ฆฌํ•ด๋ณด์ž. [UIControl.Event] ํ•จ์ˆ˜ ์ฝ”๋“œ ํ•˜๋Š” ์ผ static var touchDown: UIControl.Event A touch-down event in the control. ํด๋ฆญํ–ˆ์„ ๋•Œ static var touchDownRepeat: UIControl.Event A repeated touch-down event in the control; for this event the value of the UITouch tapCount method is greater than one. ๋ฐ˜๋ณตํด๋ฆญํ•  ๋•Œ static var touchDragInside: UIControl.Event An event where a finger is dragged insid..

[Udemy iOS & Swift Bootcamp] ํ•จ์ˆ˜ ํ•˜๋‚˜์— Button ์—ฌ๋Ÿฌ๊ฐœ ๋‹ฌ๊ธฐ (feat. Button currentTitle)

1. ํ•จ์ˆ˜ ํ•œ ๊ฐœ์— ๋ฒ„ํŠผ ์—ฌ๋Ÿฌ๊ฐœ ๋‹ฌ๊ธฐ. Ctrl ๋ˆ„๋ฅด๊ณ  ํ•จ์ˆ˜์—์„œ ๋ฒ„ํŠผ์œผ๋กœ ๋Œ์–ด๋‹น๊ธฐ๋ฉด ๋œ๋‹ค. Ctrl ๋ˆ„๋ฅด๊ณ  Code์— ๋Œ์–ด๋‹น๊ฒจ์„œ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์—ˆ๋˜ ๊ฒƒ ์ฒ˜๋Ÿผ ! ์ด ๋•Œ, ๋‹ค๋ฅธ ํ•จ์ˆ˜์— ์ž˜๋ชป์—ฐ๊ฒฐํ•œ ๊ฑธ ์‚ญ์ œํ•˜๊ณ  ์‹ถ์œผ๋ฉด ํ•ด๋‹น ๊ฐ์ฒด์— ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋“ค์ด ๋‚˜์˜จ๋‹ค. X ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด ํ•ด๋‹น ํ•จ์ˆ˜์™€์˜ ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง„๋‹ค. ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๋ฒ„ํŠผ์˜ ์ •๋ณด๋Š” sender ๊ฐ€ ๊ฐ–๊ณ  ์žˆ๋‹ค. ๋ฒ„ํŠผ์˜ title ์„ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ 3๊ฐ€์ง€์ธ๋ฐ ๊ฐ€์žฅ ํŽธํ•œ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. print(sender.currentTitle) print(sender.titleLabel?.text) print(sender.title(for: .normal)) ํ•จ์ˆ˜ ํ˜ธ์ถœ์€ playSound(soundName: sender.curr..

[[Udemy iOS & Swift Bootcamp] ๊ฒ€์ƒ‰ ๋ฐ Apple ๊ณต์‹๋ฌธ์„œ ํ™œ์šฉ๋ฐฉ๋ฒ•

1. Google 2. Stack Overflow https://stackoverflow.com/ 3. Implement 4. Docs https://developer.apple.com/documentation 5. Customise Google๊ณผ Stack Overflow๋กœ ๋ฐฉ๋ฒ•์„ ์ฐพ๊ณ  ์ฝ”๋“œ๋กœ ๊ตฌํ˜„ํ•œ๋‹ค. ์ฝ”๋“œ์˜ ์˜๋ฏธ๋ฅผ ์ฐพ์•„๋ณธ๋‹ค. ์ฝ”๋“œ๋ฅผ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•ํ•œ๋‹ค. What I want my app to do + Which programming language + Which resource ex) Play sound Swift StackOverflow Stak Overflow์—์„  ๊ฐ€์žฅ ์ตœ๊ทผ ๋‹ต๋ณ€์„ ์ ์šฉํ•ด๋ณด๊ธฐ import UIKit import AVFoundation class ViewController: UIVie..

[Udemy iOS & Swift Bootcamp] Auto Layout And Responsive UIs

๋ฐฐ๊ฒฝ์„ safe area ๊นŒ์ง€ ํ™•์žฅํ•˜๊ณ  ๋กœ๊ณ ๋ฅผ ์ • ์ค‘์•™์— ๋ฐฐ์น˜ํ•ด๋ณด์ž. UI ๊ฐ์ฒด์— ์ œ์•ฝ์กฐ๊ฑด์„ ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค. ๊ฐ์ฒด์— ์ œ์•ฝ์กฐ๊ฑด์„ ์„ค์ •ํ•˜๋ฉด ์™ผ์ชฝ์— ๋ณด์ด๋Š” Constraints ๋ถ€๋ถ„์ด ์ƒ๊ฒจ์„œ ์–ด๋–ค ์ œ์•ฝ์กฐ๊ฑด์„ ๊ฑธ์—ˆ๋Š”์ง€ ํ™•์ธ/์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ํ™”๋ฉด ํ•˜๋‹จ์— ์ œ์•ฝ์กฐ๊ฑด ์ƒ์„ฑํ•˜๋Š” ๋ฒ„ํŠผ๋“ค์ด ์žˆ๋‹ค. *๊ฐ€๋กœ ์ค‘์•™ ๋งž์ถ”๊ธฐ: Horizontally in Container *์„ธ๋กœ ์ค‘์•™ ๋งž์ถ”๊ธฐ: Vertically in Container *margin ์„ค์ •ํ•  ๋• ์ด๋ถ€๋ถ„ ! ์ ์„  -> ์‹ค์„ ์œผ๋กœ ๋ฐ”๊พธ๊ณ  margin์„ ์ฃผ๋ฉด ๋œ๋‹ค. 0์ด๋ฉด margin ์—†์ด ์ƒํ•˜์ขŒ์šฐ์— ๋”ฑ ๋ถ™์ด๊ฒ ๋‹ค๋Š” ๋ง!(ํ™•์žฅ!) ๋งจ์œ„์•„๋ž˜๊ฐ€ Safe Area๋ผ๋Š” ๋งจ์œ„๋Š” ๋ฒ ํ„ฐ๋ฆฌํ‘œ์‹œ, ๋งจ์•„๋ž˜๋Š” ํ™”๋ฉด ์˜ฌ๋ฆฌ๋Š” ๋ฐ”?๊ฐ€ ์ƒ๊ธฐ๋Š” ๋ถ€๋ถ„์ด๋‹ค. ์•ฑ์„ Safe Area ๊นŒ์ง€ ์ฑ„์šฐ๊ณ  ์‹ถ๋‹ค๋ฉด Su..

[Udemy iOS & Swift Bootcamp] Section4: Swift Programming Basics

Section4: Swift Programming Basics - Collections, Constants & Variables [Code ๊ทœ์น™] WHO.WHAT = VALUE CamelCase [๋™์ž‘ ์›๋ฆฌ] Outlet ์€ storyboard code [String Interpolation] print("Text \(2+3) Text") [Swift Cheat Sheet] - ๋ฌธ์ œ์‹œ ์‚ญ์ œ let: ์ƒ์ˆ˜ var: ๋ณ€์ˆ˜ ํ•จ์ˆ˜ ํ˜ธ์ถœ์€ aFunction(input: 1) ์ด๋ ‡๊ฒŒ ๋ถ€๋ฅด๋Š” ๊ฒƒ. input๊ฐ’์— 1๋„ฃ์–ด ~ * ๋žœ๋ค ์ˆ˜ ์ƒ์„ฑ ๋ฐฉ๋ฒ• : Int.random(in: lower...upper) or array.randomElement() or array.shuffle() Int ๋ง๊ณ  ๋‹ค๋ฅธ ํ˜•์˜ random ์ˆ˜..

[Xcode13 ์ด์Šˆ] imageLiteral ๋ช…๋ น์–ด ์ž…๋ ฅ์•ˆ๋  ๋•Œ

imageLiteral์€ ์ฝ”๋“œ์ƒ์—์„œ ์ด๋ฏธ์ง€ Asset์„ ๋ฐ”๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์ด๋‹ค. Xcode13 ์ดํ›„์— ์•ˆ๋˜๋Š”๊ฑฐ ๊ฐ™์•„์„œ ์ฐพ์•„๋ณด๋‹ˆ #imageLiteral( ๊นŒ์ง€ ์ž…๋ ฅํ•ด์•ผ ๋‚˜์˜จ๋‹ค.

728x90