-
Toggles
더보기
-
Alarm 관련 공부
https://developer.apple.com/documentation/eventkit EventKit | Apple Developer Documentation Create, view, and edit calendar and reminder events. developer.apple.com EventKit Framework라는 게 있다고한다. 캘린더나 미리알림에 접근을 제공한다고 한다. 내 앱을 쓰는 사용자가 일정을 생성하거나 검색 편집 하는 걸 도와준다고 한다. 알람을 설정하고 반복 이벤트를 설정할 수 있단다. https://developer.apple.com/documentation/eventkit/accessing_the_event_store Accessing the Event Store | A..
더보기
-
Foundations - Images
더보기
-
Foundations - Icons
더보기
-
Foundations - Dark Mode
더보기
-
개쉬운 탭뷰
들어가기 앞서!! => 밑에 적힌 모든 코드를 하나하나 다 이해할 필요 절대 없읍니다!! 그냥 아 이런 흐름이구나만 알고, 다음에 이거 만들 때 여깄는 거 긁어와야징 하는 마음으로 편하게 보시면 돼용띠한가온. 파일을 만들 때 내가 만드는 파일이 화면을 꾸미는 것이다!! 화면에 뭔가를 배치해야되고, 실제로 내 눈에 보이는 화면이어야한다! 할 때는 SwiftUI View로 파일을 만들어야하구 내가 만드는 파일이 화면을 꾸미는 건 아니고, 화면 그 뒤에서 뭔가를 정의하고, 나중에 써먹을 함수를 정의하거나 타입을 정의하는 용도일 뿐이다 할 때는 Swift File로 파일을 만들어야함니다. TabView 기본 형태 엄청 간단함미다!! View 안에서 Component들을 수직으로 묶고 싶을 때 VStack을 사용..
더보기
-
UIKit 사용한 탭뷰
들어가기 앞서!! => 밑에 적힌 모든 코드를 하나하나 다 이해할 필요 절대 없읍니다!! 그냥 아 이런 흐름이구나만 알고, 다음에 이거 만들 때 여깄는 거 긁어와야징 하는 마음으로 편하게 보시면 돼용띠한가온. 파일을 만들 때 내가 만드는 파일이 화면을 꾸미는 것이다!! 화면에 뭔가를 배치해야되고, 실제로 내 눈에 보이는 화면이어야한다! 할 때는 SwiftUI View로 파일을 만들어야하구 내가 만드는 파일이 화면을 꾸미는 건 아니고, 화면 그 뒤에서 뭔가를 정의하고, 나중에 써먹을 함수를 정의하거나 타입을 정의하는 용도일 뿐이다 할 때는 Swift File로 파일을 만들어야함니다. TabView 기본 형태 엄청 간단함미다!! View 안에서 Component들을 수직으로 묶고 싶을 때 VStack을 사용..
더보기
-
Foundations - Color
https://developer.apple.com/design/human-interface-guidelines/color Color | Apple Developer Documentation Judicious use of color can enhance communication, evoke your brand, provide visual continuity, communicate status and feedback, and help people understand information. developer.apple.com
더보기
-
Foundations - Branding
https://developer.apple.com/design/human-interface-guidelines/branding Branding | Apple Developer Documentation Apps and games express their unique brand identity in ways that make them instantly recognizable while feeling at home on the platform and giving people a consistent experience. developer.apple.com
더보기
-
Making classes observable
https://developer.apple.com/tutorials/app-dev-training/making-classes-observable Making classes observable | Apple Developer Documentation You’ve used the and property wrappers to define a value type as a source of truth for triggering updates in your view hierarchy. In this article, you’ll learn how to define a reference type as a source of truth for your app’s user interface. developer.apple.com
더보기
-
ToolbarItem
https://developer.apple.com/documentation/swiftui/toolbaritemplacement/confirmationaction confirmationAction | Apple Developer Documentation The item represents a confirmation action for a modal interface. developer.apple.com https://developer.apple.com/documentation/swiftui/toolbaritemplacement/confirmationaction confirmationAction | Apple Developer Documentation The item represents a confirmat..
더보기
-
Foundations - App icons
https://developer.apple.com/design/human-interface-guidelines/app-icons App icons | Apple Developer Documentation A unique, memorable icon communicates the purpose and personality of your experience and can help people recognize your app or game at a glance in the App Store and on their devices. developer.apple.com
더보기
-
NavigationView와 toolbar
SwiftUI에서 toolbar를 쓰려면 toolbar를 쓰려는 View가 NavigationView여야한다. toolbar는 navigationStack 구조에서만 쓸 수 있다. navigationStack의 예시로는 Form, List, TabView, ScrollView가 있다. 그렇기 때문에 NavigationView여야한다. NavigationView로 감쌌을 때, Dismiss라는 toolbar가 뜸. NavigationView로 감싸지 않았을 때, Dismiss라는 toolbar가 안 뜸.
더보기
-
List에 BackgroundColor
더보기
-
if let과 guard let
var money: Int = nil if let wallet = money { A return } B if let은 money가 nil이 아닐 때 A가 실행되고 var money: Int = nil guard let wallet = money { A return } B guard let은 money가 nil일 때 A가 실행된다.
더보기
-
Foundations - Accessibility
https://developer.apple.com/design/human-interface-guidelines/foundations/accessibility Accessibility - Foundations - Human Interface Guidelines - Design - Apple Developer Accessibility People use Apple’s accessibility features to personalize how they interact with their devices in ways that work for them. An accessible app or game supports accessibility personalizations by design and gives ever..
더보기
-
ZStack / overlay
ZStack https://developer.apple.com/documentation/swiftui/zstack/ ZStack | Apple Developer Documentation A view that overlays its subviews, aligning them in both axes. developer.apple.com 하위 보기(Subview)를 오버레이(overlay)하여 정렬하는 뷰다. ZStack 쌓아가는 정렬 -> 중앙 정렬 overlay https://developer.apple.com/documentation/swiftui/view/overlay(alignment:content:) overlay(alignment:content:) | Apple Developer Documenta..
더보기
-
Platforms - Designing for iOS
https://developer.apple.com/design/human-interface-guidelines/platforms/designing-for-ios Designing for iOS - Platforms - Human Interface Guidelines - Design - Apple Developer Designing for iOS People depend on their iPhone to help them stay connected, play games, view media, accomplish tasks, and track personal data in any location and while on the go. As you begin designing your app or game fo..
더보기
-
TextField 각 요소 오른쪽에서 왼쪽으로 드래그 해서 삭제할 수 있는 버튼 뜨게 하기
//ForEach(fighters) { fighters in // Text(fighters.fighterName) // } .onDelete { indices in fighters.remove(atOffsets: indices) } remove에서 at이 아니라 atOffsets를 받는 이유로, 애초에 onDelete가 어떠한 index가 있는 배열에서만 적용이 되게한다. 그래서 ForEach에다가 넣은 거다.
더보기
-
Picker
Picker https://developer.apple.com/documentation/swiftui/picker Picker | Apple Developer Documentation A control for selecting from a set of mutually exclusive values. developer.apple.com 상호 배타적(서로 겹치는 게 없는)인 값 집합에서 선택하기 위한 컨트롤입니다. 예를 들어, 아이스크림 맛의 열거와 선택한 맛을 담을 State 변수를 정의해라. enum Flavor: String, CaseIterable, Identifiable { case chocolate, vanilla, strawberry var id: Self { self } } @State pri..
더보기
-
Form
https://developer.apple.com/documentation/swiftui/form/ Form | Apple Developer Documentation A container for grouping controls used for data entry, such as in settings or inspectors. developer.apple.com 어떠한 입력값을 받고 싶을 때 Form을 사용한다. Form은 데이터 입력에 사용되는 컨트롤을 그룹화 하기 위한 컨테이너다. 어떤 걸 할 떄 이런 걸 하냐? 아래와 같은 걸 만들려고 할 때다. 입력을 받는 방식은 여러 개가 있다. Picker, Toggle, TextField, Slider 등
더보기
-
.map
var 초기숫자들: [Int] = [0, 1, 2, 3, 4, 5] var 초기숫자들에곱하기2한숫자들: [Int] = 초기숫자들.map { $0 * 2 } print(초기숫자들에곱하기2한숫자들) // [0, 2, 4, 6, 8, 10]
더보기
-
ForEach
SwiftUI에서는 ForEach를 사용해서 View를 반복적으로 나타낼 수 있다. 어떤배열의 각 요소는 서로를 식별할 수 있도록 Identifiable을 준수하거나, ForEach 이니셜라이저에 id 매개변수를 제공해야한다. id를 줄 때 사람 이름 자체를 id로 준다고 하면 동명이인이 있을 수 있으므로, UUID를 통해, 그 고유한 유니크 id를 생성하게 도와준다. ForEach(어떤배열) { 매개변수 in 어떤 형태로 그 배열을 보여줄 건지 } 기본 구조는 이렇다. 예를 들어서 [DailyFight] 타입을 따르는 sampleData라는 프로퍼티가 있다. static let sampleData: [DailyFight] = [ DailyFight(title: "누가 닭다리를 두 개 먹었는가?", f..
더보기
-
나만의 라벨 스타일 만들 때
SwiftUI Framework에서 제공하는 LabelStyle Protocol을 이용한다. struct TrailingIconLabelStyle: LabelStyle { // LabelStyle 프로토콜을 따를 때 필수적으로 구현해줘야되는 거 1번 func makeBody(configuration: Configuration) -> some View { // 수평으로 좌타이틀 우아이콘 설정을 해준다. HStack { configuration.title configuration.icon } } } https://developer.apple.com/documentation/swiftui/labelstyle LabelStyle | Apple Developer Documentation A type that ap..
더보기
-
타입 프로퍼티
타입 => 사람 인스턴스 => 가온, 릴리 프로퍼티 => 콧구멍수, 키, 성별 struct 사람 { var 콧구멍수: Int var 키: Int var 성별: String } 특정 타입(사람)을 따르는 여러 인스턴스(가온, 릴리)가 있다. let 가온 = 사람(콧구멍수: 2, 키: 175, 성별: "남") let 릴리 = 사람(콧구멍수: 2, 키: 160, 성별: "여") 새로운 인스턴스(가온, 릴리)를 생성할 때마다 콧구멍수, 키, 성별 프로퍼티들은 새롭게 생성된다. 하지만 사람타입의 모든 인스턴스(가온, 릴리)에 공통으로 사용되는 값 = 콧구멍수는 타입 프로퍼티라는 것을 통해 정의할 수 있다. 모든 인스턴스의 콧구멍수에 2라는 값으로 통일을 하는 거기 때문에, 사람타입을 정의할 때 초기값을 항상 정의..
더보기
-
익스텐션 (Extensions)
extension 기능을추가하고자하는어떤타입의이름 { // 추가할 새로운 기능을 여기에 담아라 } 익스텐션을 이용해 클래스, 구조체, 열거형 혹은 프로토콜 타입에 기능을 추가할 수 있습니다. static let sampleData: [DailyFight] = [ DailyFight(title: "누가 닭다리를 두 개 먹었는가?", fightTimes: 10, fighters: ["박가온", "김릴리", "김억두"], theme: .gaonRed), DailyFight(title: "누가 내 엉덩이를 만졌는가?", fightTimes: 5, fighters: ["최가온", "왕릴리", "강억두", "신짱구"], theme: .gaonYellow), DailyFight(title: "누가 사고 냈냐?", f..
더보기
-
self, Self
self 프로퍼티 (The self Property)에 대해서 알아보자. Type(인간)의 모든 Property(피부색, 키, 몸무게)는 Instance(한가온) 자체를 의미하는 self Property를 가진다. Instance(한가온)의 Method(달리기, 밥먹기, 씻기) 안에서 self Property를 이용해 Instance(한가온) 자체에 접근해서 사용할 수 있다. class Human { //Human이라는 클래스형 Type. var name: String //name이라는 Property. init(name: String) { //추후에 초기화를 통해 어떠한 Instance를 생성할 때 self.name = name //그 Instance 자체(self)의 name이라는 Property의 ..
더보기
-
Type, Instance, Property, Method, Initialization
더보기
-
Spacer와 padding의 차이
Spacer는 포함하는 Stack 레이아웃의 주축을 따라 또는 Stack에 포함되지 않은 경우 두 축을 따라 확장되는 유연한 공간입니다. Spacer는 최대한 확장되는 콘텐츠가 없는 적응형 View를 만듭니다. 예를 들어, HStack 내에 배치될 때 Spacer는 Stack이 허용하는 만큼 수평으로 확장되어 Stack 크기의 한계 내에서 형제 View를 방해하지 않도록 이동합니다. A라는 View와 B라는 View가 VStack으로 묶여있다. A와 B 사이에 Spacer를 넣는다. B가 잘리지 않는 선에서 유연하게 공간이 생기는 것을 볼 수 있다. padding(_:)은 어떤 View의 각 가장자리에 특정 패딩 양을 추가하는 Method이다. 전달인자로 length를 갖는다. length 값은 모든 ..
더보기
-
iOS App Dev Tutorials - Passing data - Passing data with bindings
Section1. Add a theme view - Step3 ZStack { RoundedRectangle(cornerRadius: 4) .fill(theme.mainColor) Label(theme.name, systemImage: "paintpalette") } ZStack은 하위 뷰를 오버레이하여 두 축에 정렬하는 뷰입니다. Section2. Add a theme picker - Step5 enum Theme: String, CaseIterable, Identifiable { CaseIterable이란, 모든 값의 컬렉션을 제공하는 타입이다. CaseIterable 유형을 사용할 때 유형의 allCases 속성을 사용하여 유형의 모든 사례 모음에 액세스할 수 있습니다.
더보기