๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป iOSun
article thumbnail
[SwiftUI] Custom TabView ๊ตฌํ˜„
iOS 2023. 6. 16. 14:12

SwiftUI๋กœ ํ”„๋กœ์ ํŠธ ์ž‘์—…์„ ํ•˜๋ฉด์„œ TabView๋ฅผ ํ†ตํ•ด ํƒญ๋ฐ”๋ฅผ ๊ตฌํ˜„ํ–ˆ๋‹ค. TabView๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ฝ”๋“œ๊ฐ€ ๋งค์šฐ ๊ฐ„๋‹จํ•˜์ง€๋งŒ.. ์ปค์Šคํ…€์—์„œ ์œ ์—ฐํ•˜์ง€ ๋ชปํ–ˆ๋‹ค. ํƒญ๋ฐ” ๋ฐฐ๊ฒฝ์ƒ‰ ๋ณ€๊ฒฝ (ํฐ์ƒ‰์œผ๋กœ), ์Šคํฌ๋กค ํ•  ๋•Œ ํˆฌ๋ช…๋„ ์—†์• ๊ธฐ ํƒญ๋ฐ” ๋†’์ด ๋ณ€๊ฒฝ ํƒญ๋ฐ” ๊ธ€์”จ์ฒด ๋ณ€๊ฒฝ ์„ ํ•ด์•ผํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— CustomTabView๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค. CustomTabView.swift import SwiftUI enum Tab { case calendar case feed } struct CustomTabView: View { @Binding var selectedTab: Tab var body: some View { HStack(alignment: .center) { Button { selectedTab = .calendar } label: ..

article thumbnail
[CS ๋ฉด์ ‘ ์งˆ๋ฌธ] ํ”„๋กœ์„ธ์Šค(2)

ํ”„๋กœ์„ธ์Šค ํ˜น์€ ์Šค๋ ˆ๋“œ์˜ ๋™๊ธฐํ™”๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”? ๋™๊ธฐํ™”๋ž€? ๋™๊ธฐํ™” ๋ฉ”์ปค๋‹ˆ์ฆ˜์€ ํ•œ ๋ฒˆ์— ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ ๋˜๋Š” ํ”„๋กœ์„ธ์Šค๋งŒ ๊ณต์œ  ๋ฆฌ์†Œ์Šค์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋„๋ก ์ƒํ˜ธ ๋ฐฐ์ œ๋ฅผ ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋™๊ธฐํ™”๋ฅผ ํ•ด์•ผํ•˜๋Š” ์ด์œ  ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ์ธ ๊ฒฝ์šฐ ์„œ๋กœ ๋‹ค๋ฅธ ์“ฐ๋ ˆ๋“œ๊ฐ€ ํ”„๋กœ์„ธ์Šค์˜ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๊ณต์œ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋™์‹œ์— ์ž์›์— ์ ‘๊ทผํ•˜๋Š” ์ƒํ™ฉ(๊ฒฝ์Ÿ ์ƒํ™ฉ)์ด ์ƒ๊ธฐ๊ฒŒ ๋˜๋Š”๋ฐ ์ด๋Ÿฐ ๊ฒฝ์Ÿ ์ƒํ™ฉ์œผ๋กœ ์ธํ•ด ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋™๊ธฐํ™” ๋ฌธ์ œ์ด๋‹ค. ์ด๋Ÿฐ ๋ฌธ์ œ๋กœ๋ถ€ํ„ฐ ๋ณดํ˜ธํ•˜๊ธฐ ์œ„ํ•ด ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค ํ˜น์€ ํ•˜๋‚˜์˜ ์“ฐ๋ ˆ๋“œ๋งŒ์ด ํ•œ ์ž์›์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์•ผ ํ•œ๋‹ค. ๋™๊ธฐํ™” ๋ฐฉ๋ฒ• Mutex(๋ฎคํ…์Šค), Semaphore(์„ธ๋งˆํฌ์–ด) ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ ๋งํ•˜๋ฉด ๋ฎคํ…์Šค๋Š” ํ•œ ๊ฐœ์˜ ์“ฐ๋ ˆ๋“œ๋งŒ ๊ณต์œ  ์ž์›์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์„œ ๊ฒฝ์Ÿ ์ƒํ™ฉ์„ ๋ฐฉ์ง€ํ•˜๋Š” ..

article thumbnail
[Swift Language Guide] ๊ตฌ์กฐ์ฒด์™€ ํด๋ž˜์Šค (Structures and Classes)
Swift Language Guide 2023. 6. 5. 20:42

๊ตฌ์กฐ์ฒด์™€ ํด๋ž˜์Šค (Structures and Classes) ๊ณตํ†ต์  ๊ฐ’์„ ์ €์žฅํ•  ํ”„๋กœํผํ‹ฐ๋ฅผ ์„ ์–ธํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•จ์ˆ˜์  ๊ธฐ๋Šฅ์„ ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ์„ ์–ธ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‚ด๋ถ€ ๊ฐ’์—. ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค. ์ƒ์„ฑ์ž๋ฅผ ์‚ฌ์šฉํ•ด ์ดˆ๊ธฐ ์ƒํƒœ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. extension์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ๋Šฅ์„ ํ™•์žฅํ•  ์ˆ˜ ์žˆ๋‹ค. Protocol์„ ์ฑ„ํƒํ•˜์—ฌ ๊ธฐ๋Šฅ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. Class (ํด๋ž˜์Šค) class VideoMode { var resolution = Resolution() var interlaced = false var frameRate = 0.0 var name: String? } let tenEighty = VideoMode() let alsoTenEighty = tenEighty if tenEighty === als..

article thumbnail
[Swift Language Guide] ์—ด๊ฑฐํ˜• (Enumerations)
Swift Language Guide 2023. 6. 5. 20:41

์—ด๊ฑฐํ˜• (Enumerations) enum CompassPoint { case north case south case east case west } enum Planet { case mercury, venus, earth, mars, jupiter, saturn, uranus, neptune } ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ํ•œ์ค„๋กœ ํ‘œ๊ธฐํ•  ์ˆ˜ ์žˆ๋‹ค. enum Beverage: CaseIterable { case coffee, tea, juice } let numberOfChoices = Beverage.allCases.count ์—ด๊ฑฐํ˜• ์ด๋ฆ„ ๋’ค์— : CaseIterable ์„ ์ž‘์„ฑ → allCases ํ”„๋กœํผํ‹ฐ๋Š” array๋กœ ๊ด€๋ จ ๋ฉ”์†Œ๋“œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฐ๊ด€๋œ ๊ฐ’ (Associated Values) enum Barcode {..

profile on loading

Loading...