Search
moon
sun

Swift Lecture

iOS & Swift The Complete iOS App Development BootCamp

β€’
55μ‹œκ°„ 짜리 κ°•μ˜!!
β€’
μ΅œλŒ€ 15μΌμ•ˆμ— λ½€κ°œκΈ°!

Section 1. Getting Start with iOS Development and Swift 5

< κ°•μ˜ μžλ£Œλ“€ >

iOS+Syllabus.pdf
144.6KB
12-Rules-to-Learn-to-Code-eBook-Updated-26.11.18.pdf
2298.9KB
App-Brewery-Massive-Bundle.zip
604545.2KB

< λ„‰λ„‰ν•œ μš©λŸ‰μ€ ν•„μˆ˜ >

Section 2. Xcode Storyboards and Interface Builder

Xcode Storyboardλ₯Ό ν™œμš©ν•˜μ—¬ κ°„λ‹¨ν•˜κ²Œ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜μ„ λ””μžμΈν•΄λ³΄μž.

1. κ°„λ‹¨ν•˜μ§€λ§Œ μœ μš©ν•œ 단좕킀 정리

β€’
cmd shift y : debug box
β€’
cmd - , cmd + : κΈ€μž 크기 μΆ•μ†Œ, 크게

2. I am Rich μ•± λ§Œλ“€κΈ°!!

μš°μ„  Projectλ₯Ό 생성할 λ•Œ Swift UIκ°€ μ•„λ‹Œ Storyboardλ₯Ό μ„ νƒν•œλ‹€.
Organization Identifier : identify your app uniquely on the AppStore
μŠ€ν† λ¦¬λ³΄λ“œλ₯Ό μƒμ„±ν•˜λ©΄ 였λ₯Έμͺ½κ³Ό 같은 화면이 생긴닀!
μ™Όμͺ½μ˜ λ„€λΉ„κ²Œμ΄μ…˜λ°”μ— Main.storyboardκ°€ 생긴 것을 확인할 수 μžˆλ‹€.
finder μ—μ„œ .xcodeproj 파일둜 ν”„λ‘œμ νŠΈλ₯Ό μ—΄ 수 μžˆλ‹€.
β€’
xcode κ΅¬κ²½ν•˜κΈ°
β—¦
ν”„λ‘œμ νŠΈ 이름 λˆ„λ₯΄λ©΄ general tab 에 갈 수 μžˆλ‹€.
β–ͺ
μ΅œμ†Œ support νƒ€κ²Ÿ(iOS)을 μ •ν•  수 μžˆλ‹€.
β–ͺ
Device Orientation
β–ͺ
Status Bar Style
β—¦
swift : μ½”λ“œ 파일, storyboard 파일 : design 파일
μš°μΈ‘νŒ¨λ„ μœ„μ˜ +λ₯Ό λˆ„λ₯΄λ©΄ μ›ν•˜λŠ” κΈ°λŠ₯듀을 μΆ”κ°€ν•  수 μžˆλ‹€.
λ„£κ³  싢은 μš”μ†Œλ₯Ό 선택 ν›„ Drag and Drop을 톡해 ν™”λ©΄ μœ„λ‘œ λŒμ–΄μ˜€λ©΄ λœλ‹€.
였λ₯Έμͺ½ λ„€λΉ„κ²Œμ΄μ…˜μ—μ„œ μ•„λž˜ μ•„μ΄μ½˜(attribute inspecter)으둜 해두면, μ„ νƒν•œ μ»΄ν¬λ„ŒνŠΈμ—μ„œ λ‹€μ–‘ν•œκ±Έ μˆ˜μ •ν•  수 μžˆλ‹€.
μ•„λž˜μ˜ μ•„μ΄μ½˜(size inspecter)을 λˆ„λ₯΄λ©΄, 크기, μœ„μΉ˜λ₯Ό μ‘°μ •ν•  수 μžˆλ‹€.
μ»΄ν¬λ„ŒνŠΈλ“€μ΄ 리슀트 λ˜λŠ”κ³³ + layer 라고 μƒκ°ν•˜λ©΄ 됨
μ‹€μ œ μ•±μ—μ„œ λ³΄μ΄λŠ” ν™”λ©΄ λ‹€μ–‘ν•˜κ²Œ 골라 확인가λŠ₯

image/icon을 μ‚¬μ΄μ¦ˆλ³„λ‘œ νŽΈν•˜κ²Œ λ§Œλ“€μ–΄μ£ΌλŠ” μ‚¬μ΄νŠΈ

I am Rich Image Assets.zip
833.5KB

κ°„λ‹¨ν•˜κ²Œ icon λ””μžμΈ κ³ ν™”μ§ˆλ‘œ λ§Œλ“€μ–΄λ³΄κΈ°

Flowchart

Xcode Sideloading Troubleshooting (1).pdf
1266.0KB

μ•„μ΄ν°μ—μ„œ ν…ŒμŠ€νŠΈν•˜κΈ°!

β€’
simulator
β€’
physical iphone
β€’
physical iphone with wifi (but 느림)

Section 3. Xcode Storyboard and Interface Builder Challenge

Make the I Am Poor App!

Section 4. Swift programming Basics - Collections, Constants & Variables

Clone an existing Xcode project from Github

μš°μ„  이미 λ§Œλ“€μ–΄μ Έ μžˆλŠ” Xcode projectλ₯Ό ν΄λ‘ ν•œλ‹€.
$ git clone https://github.com/appbrewery/Dicee-iOS13
Shell
볡사
μ˜€ν”ˆμ†ŒμŠ€ iOS Apps. λ‹€μ–‘ν•œ μ•±λ“€ μ‹€ν–‰ν•΄λ³΄μž

Design the user interface

우츑 νŒ¨λ„μ„ μ‚¬μš©ν•΄μ„œ κ°„λ‹¨ν•˜κ²Œ λ””μžμΈ ν•  수 μžˆλ‹€.

Changing UI Elements programmatically

dot ν•¨μˆ˜μ‚¬μš©!
[객체이름].image
Swift
볡사
μ½”λ“œμƒμ—μ„œ Asset의 이미지 μ ‘κ·Όν•˜κΈ°
Image Literal
Swift
볡사
였λ₯Έμͺ½μ²˜λŸΌ 이미지가 생기면 더블클릭! 이후 μ›ν•˜λŠ” 이미지λ₯Ό κ³ λ₯΄λ©΄ λœλ‹€.

Detect user interaction and respond to it

이제 roll λ²„νŠΌμ— κΈ°λŠ₯을 λ„£μ–΄λ³΄μž
Event에 λ‹€μ–‘ν•œ κΈ°λŠ₯듀은 이후에 μ•Œμ•„λ³΄μž.
Touch Up InsideλŠ” 'λ²„νŠΌ ν…Œλ‘λ¦¬ μ•ˆμ—μ„œ touch λ™μž‘μ΄ 일어났을 λ•Œ'λΌλŠ” μ˜λ―Έμ΄λ‹€.
이제 λ²„νŠΌμ„ λ„£κ³ λ‚˜λ©΄ μ•„λž˜μ™€ 같은 μ½”λ“œκ°€ μƒμ„±λœλ‹€.
@IBAction func rollButtonPressed(_ sender: UIButton) { // what to do }
Swift
볡사
β€’
File β†’ New β†’ Playground μ—μ„œ Swift μ—°μŠ΅ κ°€λŠ₯!

Learn to use Swift Variables and Arays to store data

β†’ swift dive
πŸ₯‘
Naming Conventions - camelCase ← Swift! - kebab-case - snake_case

Learn about randomisation in Swift

Int.random(in: 0...5)
Swift
볡사
랜덀 μ£Όμ‚¬μœ„ μ–΄ν”Œ λ§Œλ“€κΈ°
import UIKit class ViewController: UIViewController { // IBOutlet allows me to reference a UI element @IBOutlet weak var diceImageView1: UIImageView! @IBOutlet weak var diceImageView2: UIImageView! // var leftDiceNumber = 1 // var rightDiceNumber = 5 override func viewDidLoad() { super.viewDidLoad() //WHO WHT VALUE diceImageView1.image = #imageLiteral(resourceName: "DiceSix") diceImageView2.image = #imageLiteral(resourceName: "DiceTwo") // diceImageView1.alpha = 0.5 } @IBAction func rollButtonPressed(_ sender: UIButton) { diceImageView1.image = [ #imageLiteral(resourceName: "DiceOne"), #imageLiteral(resourceName: "DiceTwo"), #imageLiteral(resourceName: "DiceThree"), #imageLiteral(resourceName: "DiceFour"), #imageLiteral(resourceName: "DiceFive"), #imageLiteral(resourceName: "DiceSix") ][Int.random(in: 0...5)] diceImageView2.image = [ #imageLiteral(resourceName: "DiceOne"), #imageLiteral(resourceName: "DiceTwo"), #imageLiteral(resourceName: "DiceThree"), #imageLiteral(resourceName: "DiceFour"), #imageLiteral(resourceName: "DiceFive"), #imageLiteral(resourceName: "DiceSix") ][Int.random(in: 0...5)] // leftDiceNumber += 1 // rightDiceNumber -= 1 } }
Swift
볡사
λ°°μ—΄μ˜ 경우 μ•„λž˜μ™€ 같이 μ‚¬μš© κ°€λŠ₯
diceImageView1.image = diceArray.randomElement() diceImageView2.image = diceArray[Int.random(in: 0...5)]
Swift
볡사
λ…Έλž€μƒ‰ : warning
빨간색 : error

Section 5. Swift Programming Basics Challenge

λžœλ€μ„ ν™œμš©ν•œ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜ λ§Œλ“€κΈ°!
λ©μ²­ν•˜κ²Œ rm -rf둜 μ§€μ›Œλ²„λ Έλ‹€.. (.git을 μ§€μš΄λ‹€λŠ” κ±Έ...)

Section 6. Auto Layout and Responsive UIs

Size Classes and orientation

Understand Constraints

Learn about Alignment and Pinning

Use Containers for more fine grained control

Learn about StackViews

Section 7. Using and Understanding Apple Documentation

setup the Skeleton Project

Figure out how to play sound using Apple Documentation and Stack Overflow

Learn about Swift Functions

ν•¨μˆ˜μ— λŒ€ν•œ κΈ°λ³Έ 지식듀 β†’ 일반적인 ν”„λ‘œκ·Έλž˜λ° μ–Έμ–΄λž‘ 동일

Linking multiple elements to one IBAction

Creating functions with inputs

Section 8. Intermediate Swift Programming - Control Flow and Optionals

Autoshrinkλ₯Ό ν†΅ν•΄μ„œ μžλ™μœΌλ‘œ View μ‚¬μ΄μ¦ˆμ— λ§žλŠ” Minimum Font Sizeλ₯Ό μ§€μ •ν•΄μ€€λ‹€!

Float vs Double

Float와 Double, Swiftμ—μ„œλŠ” μ‹€μˆ˜ νƒ€μž…μ˜ μžλ£Œν˜•μ„ μ‚¬μš©ν•  λ•Œ, λ‘˜ 쀑 μ–΄λ–€ 것을 μ‚¬μš©ν• κΉŒ?
Swift Docsμ—μ„œλŠ” μ•„λž˜μ™€ 같은 κ°€μ΄λ“œλ₯Ό μ œκ³΅ν•œλ‹€
Double has a precision of at least 15 decimal digits, whereas the precision of Float can be as little as 6 decimal digits. The appropriate floating-point type to use depends on the nature and range of values you need to work with in your code. In situations where either type would be appropriate, Double is preferred.
μš°μ„  Double μžλ£Œν˜•μ€ μ†Œμˆ˜μ  μ΄ν•˜ 15자리의 정밀도λ₯Ό κ°€μ§€κ³ , Float μžλ£Œν˜•μ€ μ†Œμˆ˜μ  μ΄ν•˜ 6자리의 정밀도λ₯Ό κ°€μ§„λ‹€. μž‘μ—…ν•  κ°’μ˜ νŠΉμ„±μ— 따라 μ λ‹Ήν•œ μžλ£Œν˜•μ„ μ„ νƒν•˜μ—¬ μ‚¬μš©ν•˜λ©΄ λœλ‹€.
ν•˜μ§€λ§Œ 두 μžλ£Œν˜• λͺ¨λ‘ μ‚¬μš©κ°€λŠ₯ν•œ μƒν™©μ—μ„œλŠ” Doubleμžλ£Œν˜•μ„ μ„ ν˜Έν•œλ‹€κ³  λ˜μ–΄μžˆλ‹€.
Progress View와 같이 Floatν˜• μžλ£Œν˜• μ‚¬μš©μ΄ Fix된 κ²½μš°κ°€ μ•„λ‹ˆλΌλ©΄, 일반적인 λ³€μˆ˜μ—μ„œλŠ” Double μžλ£Œν˜•μ„ μ“°λŠ” 것이 쒋아보인닀.

Section 9. iOS App Design Patterns and Code Structuring

Show quiz questions

let quiz = [ "Four + Two is equal to Six.", "Five - Three is equal to Six.", "Three + Eight is equal to Eleven." ] var questionNumber = 0 override func viewDidLoad() { super.viewDidLoad() updateUI() } @IBAction func answerButtonPressed(_ sender: UIButton) { questionNumber += 1 updateUI() } func updateUI() { questionLabel.text = quiz[questionNumber] }
Swift
볡사

Check the answers

2차원 배열을 ν™œμš©ν•˜μž
var arr = [["text", bool],["text", bool],["text", bool]]
Swift
볡사

Learn about Swift Structures

β†’ in Swift Deep Dive

Learn about design patterns and use the Model View Controller pattern

What is Design Pattern?

A proven solution to a common problem

The MVC Pattern

Model-View-Controller
β€’
Model
β†’ Data & Login
β€’
View
β†’ User Interface
β€’
Controller
β†’ Mediator
View 와 Model은 μ ˆλŒ€ μ§μ ‘μ μœΌλ‘œ ν†΅μ‹ ν•˜μ§€ μ•ŠλŠ”λ‹€. 항상 Controllerλ₯Ό κ±°μ³μ„œ!!

Learn about Swift Functions that can have outputs

Understand immutability

Section 10. iOS App Design Pattern Challenge

MVC Pattern App Challenge

Section 11. Advanced Swift Programming - Classes, Ingeritance & Advanced Optionals

Learn to use UISliders.

@IBAction func hegithSlider(_ sender: UISlider) { print(String(format: "%.2f", sender.value)) heightLabel.text = String(format: "%.2f", sender.value) + "m" } @IBAction func weightSlider(_ sender: UISlider) { print(Int(sender.value)) weightLabel.text = String(format: "%.0f", sender.value) + "Kg" }
C
볡사

Create Swift Classes.

Understand the difference between Classes and Structs.

Learn to create UI programmatically without Storyboards

Create multi-screen apps by learning about segues.

Learn about advanced features of Optionals, including Optional Binding, Optional Chaining and the Nil Colalescing Operator

Learn to use Color Literals to select colours from a palette