목록Swift (208)
HIT해

ifLet 어디서 많이 보지 않았는가 바로 if let 이랑 비슷한 역할을 한다. 주로 상태가 존재하는 경우에만 특정 뷰의 Modifier를 적용하려고 할때 사용된다.상태의 값이 존재할때만 활성화되고 그렇지 않다면 무시된다. 예시 코드를 보자 1. Reducer@Reducerstruct AlertAndConfirmationDialog { @ObservableState struct State: Equatable { @Presents var alert: AlertState? @Presents var confirmationDialog: ConfirmationDialogState? var count = 0 } enum Action { case alert(PresentationActi..
https://developer.apple.com/documentation/swiftui/view/refreshable(action:) refreshable(action:) | Apple Developer DocumentationMarks this view as refreshable.developer.apple.com nonisolatedfunc refreshable(action: @escaping () async -> Void) -> some View 간단하게 새로고침을 구현할 수 있는 키워드다. 새로고침 UI가 상단에 생성되고 안에 정의한 함수들이 실행된다 사용방법struct RefreshableView: View { let store: StoreOf @State var isLoading = fa..
NavigationStack | Apple Developer DocumentationA view that displays a root view and enables you to present additional views over the root view.developer.apple.com NavigationStack 이란?RootView를 표시하고 RootView 위에 추가 뷰를 표시할수 있는 뷰. iOS 16.0 이상에서 동작한다.@MainActor @preconcurrencystruct NavigationStack where Root : View 공식문서상에 적힌 개요를 확인해보자. 1. 기본 네비게이션 스택NavigationStack을 사용하여 뷰의 스택을 루트 뷰 위에 표시한다. 사용자는 Nav..
https://school.programmers.co.kr/learn/courses/30/lessons/181943 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationfunc solution(_ my_string:String, _ overwrite_string:String, _ s:Int) -> String { var result :String = "" result += String(my_string.prefix(s)) result += overwrite_string let trailingI..

https://school.programmers.co.kr/learn/courses/30/lessons/181944 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationlet a = Int(readLine()!)!print(a, "is", a % 2 == 0 ? "even" : "odd")

https://school.programmers.co.kr/learn/courses/30/lessons/181945 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationlet s1 = readLine()!s1.forEach{ print($0)}

https://school.programmers.co.kr/learn/courses/30/lessons/181946 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationlet inp = readLine()!.components(separatedBy: [" "]).map { $0 }print(inp.joined())
https://school.programmers.co.kr/learn/courses/30/lessons/181947 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationlet n = readLine()!.components(separatedBy: [" "]).map { Int($0)! }let (a, b) = (n[0], n[1])print("\(a) + \(b) =", a+b )