반응형 swiftUI17 100 days of SwiftUI - Day28 어제의 프로그램을 조금더 개선? 수정? 하는 내용이다. 위의주석에 나와있는것처럼1. VStack -> Section 으로 변경하기2. Stepper -> Picker 변경하기3. 상단 계산버튼 제거하고 아래에 크게 결과 나타내기 이다./*1. Replace each VStack in our form with a Section, where the text view is the title of the section. Do you prefer this layout or the VStack layout? It’s your app – you choose!2. Replace the “Number of cups” stepper with a Picker showing the same range of values.3... 2024. 11. 24. 100 days of SwiftUI - Day27 저번 시간에 결과로 뽑아낸 ML모델을 이용해서 간단한 앱을 만든다.제목하야 더 나은 숙면을 위하여!알다시피 저번 ML이 하루에 먹은 커피양, 일어나고 싶은 시간, 자고싶은 시간을 입력하면 몇시에 자야 되는지에 대해서 추측할수 있는 거다. 그래서 UI는 그것들을 입력받아서 ML을 호출해서 팝업으로 띄워주는 내용이다. //// ContentView.swift// BetterRest//// Created by HanTJ on 11/23/24.//import SwiftUIimport CoreMLstruct ContentView: View { @State private var wakeUp = defaultWakeTime @State private var sleepAmount = 8.0 @S.. 2024. 11. 23. 100 days of SwiftUI - Day26 새로운게 또 나온다. 그거슨 바로 ML. 머쉰러닝!xcode를 이용해서, 머신러닝을 돌리고 모델링을 할 수 있다. 교육에서는 BetterRest라는 앱을 만드는데, 깨어있는시간+커피+추정자는시간을 입력하면 실제 잔시간을 예측하는 모델이다.아래는 교육용 자료니 일단 다운받고. Xcode를 실행하고, Xcode > Open Developer Tool > Create ML 을 선택생성할 폴더를 선택하고, New Document 를 선택 예측모델? 템플릿들이 뜨는데 Tabular Regression 선택ProjectName : BetterRest 입력 > Next Traing Data 밑에 드랍다운을 선택하고 csv파일을 선택Target : actualSleepFeatures: 나머지 3개 선택상단에 플레이 .. 2024. 11. 22. 100 days of SwiftUI - Day25 정리의 시간과 마지막 도전!가위바위보 게임이지만 승리를 정해놓고 가위바위보를 내기!!/** So, very roughly:Each turn of the game the app will randomly pick either rock, paper, or scissors.Each turn the app will alternate between prompting the player to win or lose.The player must then tap the correct move to win or lose the game.If they are correct they score a point; otherwise they lose a point.The game ends after 10 questions, at w.. 2024. 11. 21. 100 days of SwiftUI - Day24 이번에는 저번에 배운 뷰의 조건, 커스텀등을 이전 프로젝트에 적용시키는 과제 이다.//Go back to project 1 and use a conditional modifier to change the total amount text view to red if the user selects a 0% tip.// 수정부분 foregroundColor 부분 추가!Section("전체 금액") { Text(totalAmount, format: .currency(code: Locale.current.currency?.identifier ?? "USD" )) .foregroundColor(tipPercentage == 0 ? Color.red : Color.black)}배운데로 삼항 연산자 사.. 2024. 11. 20. 100 days of SwiftUI - Day23 이번 클래스는 왜 View 가 클래스가 아닌 struct 인지 와 기본 템플릿의 body 는 왜 some View 를 리턴하는가에 대한 이야기 였다. 결론만 요약해서 말하면,클래스 인 경우 쓰지 않는 속성과 메소드로 간단한 장면을 그릴때에도 무거워지기 때문에 가볍고 빠르게 만들기 위해 View 를 쓰고 있고some View 는 역시 어떤걸 리턴할 지 모르지만모두 대응하는 값으로 설정하기 위한것이다! 로 볼수 있겠다. (View 는 protocol 이다 )추가적으로, modifier 의 순서는 중요하다! modifier 는 구조체의 끝에 .로 선언 및 추가 수정을 가하는것 인데,그냥 UI 컴포넌트를 빌더 패턴 체인 호출(java에서처럼) 같이 쓴다고 보면 될듯 하다. 어쨌든 순서의 중요성은 아래의 예를 확.. 2024. 11. 19. 100 days of SwiftUI - Day19 19일차는 과제 데이 다!저번 뿜빠이 프로그램을 베이스로 하여 단위 변환툴을 만드는 것이다. 난 온도와 길이 변환 툴을 만들어따!//// ContentView.swift// Changer//// Created by HanTJ on 11/17/24.//import SwiftUIstruct ContentView: View { @State private var selectedTemperture: String = "섭씨" @State private var inputTempeture:Double = 0 let tempertures = ["섭씨", "화씨", "켈빈"] var calculateTemperture:Double { switch selectedTemperture {.. 2024. 11. 17. 100 days of SwiftUI - Day16, Day17, Day18 드디어 본격적인 보이는? 프로그램의 시작!. SwiftUI 를 이용해, 뿜빠이 프로그램을 만들었다.//// ContentView.swift// WeSplit//// Created by HanTJ on 11/16/24.//import SwiftUIstruct ContentView: View { @State private var checkAmount = 0.0 @State private var numberOfPeople = 2 @State private var tipPercentage = 20 @FocusState private var amountIsFocused: Bool @State private var totalAmount: Double = 0 @State priv.. 2024. 11. 16. 이전 1 2 다음 반응형