728x90
๋ฐ˜์‘ํ˜•

SwiftUI 5

[ios] swift MVVM vs MVC ์ฐจ์ด

MVVM : MVC์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์— ์ฃผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋””์ž์ธ ํŒจํ„ด Model - View - ViewModel ๐Ÿ’ก MVC์™€ MVVM ๋‹จ์ˆœ์ฐจ์ด Controller๊ฐ€ ์•„๋‹Œ ViewModel ๊ณ„์ธต์„ ๊ฐ€์ง€๊ณ  ์žˆ์Œ ViewModel ๋˜ํ•œ Controller์ฒ˜๋Ÿผ View์™€ Model์˜ ์ค‘๊ฐ„ ๊ณ„์ธต ์—ญํ• ์„ ํ•จ 1. Model : ๋ฐ์ดํ„ฐ์™€ ๊ด€๋ จ๋œ ์ฝ”๋“œ๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š” ๊ณ„์ธต (MVC์˜ Model๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€) ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์•„๋‘๊ธฐ ์œ„ํ•œ ๊ตฌ์กฐ์ฒด๋“ค(struct) ๋„คํŠธ์›Œํฌ ๋กœ์ง JSON ํŒŒ์‹ฑ ์ฝ”๋“œ ๋“ฑ ... struct Person { // Person์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ ๋‹ด์€ ๊ตฌ์กฐ์ฒด let name: String var age: Int init(json: JSON) { // JSON ํŒŒ์‹ฑ name = json["name"].s..

[swift] swiftui Text ์‚ฌ์ด์ฆˆ์— ๋งž์ถฐ์„œ frameํฌ๊ธฐ ์ •ํ•˜๊ธฐ (fixedSize)

์˜ˆ์‹œ : ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด struct Title: View { var body: some View { VStack { Text("Statistics") Rectangle() .foregroundColor(.red) .frame(height: (5.0)) } } } ์œ„์™€ ๊ฐ™์ด ๋นจ๊ฐ„์ค„์ด ์ƒ๊ธด๋‹ค. ํ•˜์ง€๋งŒ ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ๊ฑด..!! ์ด๋ ‡๊ฒŒ text ์‚ฌ์ด์ฆˆ์— ๋งž์ถฐ์„œ frameํฌ๊ธฐ๊ฐ€ ์ง€์ •๋˜๊ธธ ๋ฐ”๋ž€๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ๋œ๋‹ค !!!! struct Title: View { var body: some View { VStack { Text("Statistics") Rectangle() .foregroundColor(.red) .frame(height: (5.0)) }.fixedSize() } } ํ•ด๊ฒฐ๋ฐฉ๋ฒ• :..

[swift] UI element ๋ฆฌ์ŠคํŠธ

apple developer ์˜ ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€ ์ฐธ๊ณ ..! https://developer.apple.com/design/human-interface-guidelines/ios/overview/themes/#//apple_ref/doc/uid/TP40006556-CH13-SW1 Themes - iOS - Human Interface Guidelines - Apple Developer iOS Design Themes As an app designer, you have the opportunity to deliver an extraordinary product that rises to the top of the App Store charts. To do so, you'll need to meet high ex..

[Xcode] Preview crashed ํ˜„์ƒ

๋‚˜๋Š” swift ์ž…๋ฌธ์ž๋‹ค swfit์–ธ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋ฐ˜๋“œ์‹œ xcode์—์„œ ์จ์•ผํ•œ๋‹ค (๋‹ค๋“ค ์•Œ์ฃ ?) ์ด๋Ÿฐ ์ž…๋ฌธ์ž์—๊ฒŒ preview๊ฐ€ ์ž๊พธ ์‹œ๋ จ์„ ์ค€๋‹ค ๋‚จ๋“ค์ด ํ•˜๋Š”๊ฑฐ ๋ณด๋‹ˆ๊นŒ preview๋ฅผ ํ†ตํ•ด์„œ dynamicํ•˜๊ฒŒ ์ฝ”๋”ฉํ•˜๊ณ  uiํ™•์ธํ•˜๋˜๋ฐ ๋‚˜๋Š” ๋ญ ํ™”๋ฉด ํด๋ฆญ๋งŒ ํ•˜๋ฉด ์ž๊พธ preview crashed ํ•˜๋ฉด์„œ ๋นจ๊ฐ„ ์—‘์Šค๊ฐ€ ๋œฌ๋‹ค ใ… ใ… ใ…  ๊ฒฐ๊ตญ ์—๋Ÿฌ๋ฅผ ๊ณ ์ณ๋ณด๊ธฐ๋กœ..! preview์ฐฝ ์ƒ๋‹จ์— ๋ณด๋ฉด preview crashed์— ๋Œ€ํ•œ ์„ค๋ช…์„ ํ•ด์ค€๋‹ค. ํ•„์ž์˜ ๊ฒฝ์šฐ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋–ด๋‹ค ์ผ๋‹จ ํ•ด๊ฒฐ์„ ํ•˜๊ณ  ์‹ถ์—ˆ๊ธฐ ๋–„๋ฌธ์— Diagnostics๋ฅผ ํด๋ฆญํ•ด๋ดค๋‹ค HumanReadableNSError: Unable to boot device due to insufficient system resources. Please see Simula..

Computer Science 2021.06.04
728x90
๋ฐ˜์‘ํ˜•