목록Swift (208)
HIT해

https://school.programmers.co.kr/learn/courses/30/lessons/181948 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr import Foundationlet tmp = (#"!@#$%^&*(\'"?:;"#)print(tmp) 특수문자를 출력할때는 (#"특수문자"#)

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

store.send().finish() vs store.send()store.send():이 코드는 TCA(Typically Composable Architecture)에서 액션을 스토어로 전송한다.기본적으로 이 메서드는 비동기 작업을 시작하고, 해당 액션이 처리되는 동안의 작업을 관리하지 않는다.store.send().finish():finish()는 send(_:) 메서드가 반환하는 Effect의 메서드.finish()는 해당 액션이 완료되었음을 나타내는 신호를 보낸다finish의 역할비동기 작업의 완료 신호:finish()는 비동기 작업이 완료되었음을 나타내는 신호를 보낸다.비동기 효과가 끝났을 때, 상태를 업데이트하거나 후속 작업을 처리하는 데 사용된다.상태 동기화:액션이 완료된 후, 상태가 올바..

블렌더에서 디자인한 질감 및 양감을 구현하기위해 SCNLight를 사용해서 방향성조명을 추가해 명암효과를 내려 했지만 확실히 블렌더에서 디자인 된 느낌을 따라하기에는 부족함이 있었다. 그래서 나온 해결방법이 블렌더 hdri 적용이다. 우선 hdri 파일을 불러와보자. 1. hdri 파일 프로젝트에 추가하기나는 이부분이 제일 어려웠다. UIImage로 불러와야하는지 Image로 불러와야하는지 어떠한 래퍼런스도 찾아볼 수 없었다. 또 어떤 형태로 받아와야하는지도.. 그래서 로컬 파일을 불러오는 형식으로 만들어보았다. guard let hdrURL = Bundle.main.url(forResource: "lythwood_field_4k", withExtension: "hdr") else { ..

TCA Reducer 내부에서 열거형을 일치시킬때 자주 사용된다. enum 타입에서 케이스 매칭을 보다 직관적으로 할 수 있게 도와준다. 또한 상태를 스코프로 다룰 수 있어 오류를 방지할 수 있다. 예시를 보자 enum Action { case alert(PresentationAction) case alertButtonTapped case confirmationDialog(PresentationAction) case confirmationDialogButtonTapped @CasePathable enum Alert { case incrementButtonTapped } @CasePathable enum ConfirmationDialog { ..

defer란?Swift에서 코드 블록의 마지막에 실행될 코드를 예약할때 사용된다.defer 블록내의 코드는 해당 코드 블록이 종료되기 직전에 실행된다. 자원 해제, 상태 복구, 정리 작업과 같이 코드 블록이 끝날 때 반드시 수행되어야하는 작업을 지정하는데 쓰인다. func exampleFunction() { print("Start") defer { print("Deferred: This will run at the end of the function") } print("End")} 실행결과StartEndDeferred: This will run at the end of the function

전체 코드import ComposableArchitectureimport SwiftUIprivate let readMe = """ This application demonstrates how to handle long-living effects, for example notifications from \ Notification Center, and how to tie an effect's lifetime to the lifetime of the view. Run this application in the simulator, and take a few screenshots by going to \ *Device › Screenshot* in the menu, and observe that the U..

소스코드 개요더보기이 화면에서는 \를 사용하여 작은 기능을 사용하여 더 큰 기능으로 구성하는 방법을 보여 줍니다리듀서 빌더와 'Scope' 리듀서, 매장의 'Scope' 오퍼레이터.카운터 화면의 도메인을 재사용하여 두 번 더 큰 도메인에 임베딩합니다 전체 코드@Reducerstruct TwoCounters { @ObservableState struct State: Equatable { var counter5 = Counter.State() var counter2 = Counter.State() } enum Action { case counter1(Counter.Action) case counter2(Counter.Action) } var body: some Reducer ..