<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by kangYundol on Medium]]></title>
        <description><![CDATA[Stories by kangYundol on Medium]]></description>
        <link>https://medium.com/@dbstj169?source=rss-2f530c00cde7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wyKfW8cyEZ5slMRrN1pb9g.png</url>
            <title>Stories by kangYundol on Medium</title>
            <link>https://medium.com/@dbstj169?source=rss-2f530c00cde7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:51:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dbstj169/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[[Alamofire] Interceptor를 활용한 토큰 재발급 구현(feat. retry 무한 루프 해결기)]]></title>
            <link>https://medium.com/daily-monster/alamofire-interceptor%EB%A5%BC-%ED%99%9C%EC%9A%A9%ED%95%9C-%ED%86%A0%ED%81%B0-%EC%9E%AC%EB%B0%9C%EA%B8%89-%EA%B5%AC%ED%98%84-feat-retry-%EB%AC%B4%ED%95%9C-%EB%A3%A8%ED%94%84-%ED%95%B4%EA%B2%B0%EA%B8%B0-18e467a45c08?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/18e467a45c08</guid>
            <category><![CDATA[alamofire]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Wed, 07 Aug 2024 16:47:57 GMT</pubDate>
            <atom:updated>2024-08-07T16:47:57.938Z</atom:updated>
            <content:encoded><![CDATA[<p>Alamofire의 Interceptor를 활용하여 토큰 재발급을 구현하고, 이 과정에서 발생했던 무한루프 문제 해결 과정을 정리하였습니다.</p><p><a href="https://medium.com/daily-monster/alamofire-interceptor-%EB%82%B4%EB%B6%80-%EA%B5%AC%ED%98%84-%EC%95%8C%EC%95%84%EB%B3%B4%EA%B8%B0-efdd49bd26e7">[Alamofire] Interceptor 내부구현 알아보기</a> 에서 Interceptor가 어떤 원리로 동작하는지 정리했기 때문에 사용 이유와 간단한 코드 설명만 진행하도록 하겠습니다.</p><h3>Interceptor 사용 이유</h3><p>본 서비스의 토큰 재발급 로직은 아래와 같습니다.</p><ol><li>API 호출</li><li>헤더의 accessToken이 만료된 경우(상태코드로 401 반환) refreshToken을 활용하여 토큰 재발급</li><li>재발급한 토큰을 사용하여 다시 1번의 API 호출</li><li>만약 refreshToken도 만료된 경우 혹은 토큰 재발급에 실패한 경우 로그인 화면으로 이동</li></ol><p>처음에는 1번부터 4번까지의 과정을 앱에 진입할 때만 확인해주면 된다고 생각했습니다.</p><p>하지만 테스트 과정에서 유저가 앱을 사용하는 동안에도 토큰이 만료되는 일이 발생했습니다. 이 부분을 해결하기 위해서 모든 API를 호출할 때마다 헤더에 있는 accessToken의 만료 여부를 확인해야 했습니다.</p><p>그러다 보니 중복코드가 너무 많이 발생하였는데, 마침 Alamofire를 추상화한 Moya를 사용하고 있던터라 Interceptor를 통해 구현하기로 결정했습니다!-!</p><h3>구현 코드 및 문제점</h3><p>️️코드 설명에 앞서 아래 코드는 무한루프를 도는 잘못된 코드입니다⚠️</p><pre><br> func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result&lt;URLRequest, Error&gt;) -&gt; Void) {<br>  guard let urlString = Bundle.main.infoDictionary?[&quot;BASE_URL&quot;] as? String,<br>     let url = URL(string: urlString) else {<br>   fatalError(&quot;🚨Base URL을 찾을 수 없습니다🚨&quot;)<br>  }<br><br>  guard urlRequest.url?.absoluteString.hasPrefix(urlString) == true,<br>     let accessToken = PophoryTokenManager.shared.fetchAccessToken(),<br>     let refreshToken = PophoryTokenManager.shared.fetchRefreshToken() else {<br>   completion(.success(urlRequest))<br>   return<br>  }<br>  <br>  var urlRequest = urlRequest<br>  urlRequest.addValue(&quot;Bearer \(PophoryTokenManager.shared.fetchAccessToken()!)&quot;, forHTTPHeaderField: &quot;Authorization&quot;)<br>  print(&quot;🍥🍥🍥adator 적용 \(urlRequest.headers)&quot;)<br>  completion(.success(urlRequest))<br> }</pre><p>adapt는 네트워크 요청을 실행하기 전 거치는 코드입니다. 요청 전 header에 새로운 accessToken값을 저장하고 completion(.success(urlRequest))을 통해 API 호출을 진행합니다.</p><pre>func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -&gt; Void) {<br>  print(&quot;🍥🍥🍥retry 진입&quot;)<br>  guard let response = request.task?.response as? HTTPURLResponse, response.statusCode == 401 else {<br>   completion(.doNotRetryWithError(error))<br>   return<br>  }<br><br>  NetworkService.shared.authRepostiory.updateRefreshToken { result in<br>   switch result {<br>   case .success(let response):<br>    guard let data = response as? UpdatedAccessTokenDTO else {<br>     DispatchQueue.main.async {<br>      RootViewSwitcher.shared.setRootView(.onboarding)<br>     }<br>     completion(.doNotRetryWithError(error))<br>     return<br>    }<br>    PophoryTokenManager.shared.saveAccessToken(data.accessToken)<br>    PophoryTokenManager.shared.saveRefreshToken(data.refreshToken)<br>    completion(.retry)<br>   default:<br>    DispatchQueue.main.async {<br>     RootViewSwitcher.shared.setRootView(.onboarding)<br>    }<br>    completion(.doNotRetryWithError(error))<br>   }<br>  }<br> }<br>}</pre><p>adapt를 거친 네트워크 요청이 실패하는 경우 retry에 진입합니다. 이때 에러코드가 401인 경우에만 refreshToken을 사용하여 토큰을 재발급 해주도록 하였습니다. 재발급에 성공하는 경우 .retry 를 통해 요청했던 API를 재호출하도록 하였습니다.</p><p>만약 토큰 재발급에 실패하는 모든 경우에는 메인스레드에서 로그인 화면으로 전환하고, .doNotRetryWithError로 무한루프에 빠지지 않도록 하였습니다.</p><p>그런데 미친듯이 무한루프가 발생했습니다. why,, 어째서.,,?</p><h3>문제 원인 및 해결방법</h3><h4>문제점</h4><p>먼저 토큰 갱신이 제대로 이루어졌는지 breakpoint와 plugin 출력 로그를 통해 확인했습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLzb1z-hJZqc5SQzudiUcg.png" /></figure><p>토큰 갱신은 아주 잘 되고 있었고 앱 내부에도 잘 저장이 되고 있었습니다!-!</p><p>제가 앞서 디버깅을 위해 print(&quot;🍥🍥🍥adaptor 적용 \(urlRequest.headers)) 코드를 작성했는데요,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FDlC4Filoxqu4TMT5QcsdQ.png" /></figure><p>이처럼 Authorization에 Bearer 토큰이 잘 들어가있었습니다.</p><p>하지만 이럴수가 ㅋ ㅋ아래 코드를 자세히 보시면 Authorization에 Bearer로 시작하는 토큰이 두 개 들어가있는거 보이시나요?</p><p>이거 찾는데 무려 5시간이 걸렸습니다. . .</p><h4>해결</h4><p>원인은 바로 addValue 였습니다.</p><p>urlRequest의 헤더값을 수정하는 방법은 세 가지가 있습니다.</p><p>1️⃣ urlRequest.addValue(_:forHTTPHeaderField)</p><ul><li>addValue는 앞에 이미지처럼 이미 존재하는 키 값이라면 값을 append해준다.</li><li>키 값이 존재하지 않으면 헤더에 새로운 key-value쌍을 만들어준다.</li></ul><p>2️⃣ urlRequest.setValue(_:forHTTPHeaderField)</p><ul><li>setValue는 같은 key값이 있더라도 value를 무조건 갱신해준다.</li></ul><p>3️⃣ urlRequest.headers.update</p><pre>내부 구현<br>/// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`.<br>///<br>/// - Parameters:<br>///   - name:  The `HTTPHeader` name.<br>///   - value: The `HTTPHeader` value.<br>public mutating func update(name: String, value: String) {<br>    update(HTTPHeader(name: name, value: value))<br>}<br><br>/// Case-insensitively updates or appends the provided `HTTPHeader` into the instance.<br>///<br>/// - Parameter header: The `HTTPHeader` to update or append.<br>public mutating func update(_ header: HTTPHeader) {<br>    guard let index = headers.index(of: header.name) else {<br>        headers.append(header)<br>        return<br>    }<br><br>    headers.replaceSubrange(index...index, with: [header])<br>}</pre><p>update의 내부코드를 살펴보면 setValue와 같은 역할을 한다.</p><p>그래서 setValue로 수정해주었더니 무한루프 지옥에서 빠져나올 수 있었습니다!-!</p><p>앞으로 코드 한 줄 한 줄 어떤 역할을 하는지, 내가 쓰는 코드가 무슨 의미인지 제대로 알고 쓰자 반성하며 오늘 글은 마무리 짓겠습니다❕</p><h3>추가</h3><p>헤더에 key값은 무슨 차이가 있을까?</p><p>➡️ Authorization, accessToken 등의 key 이름은 취향 차이</p><p>Bearer를 붙이는 이유?</p><p>️➡️ 우리 서비스에서 사용하는 형태의 토큰인지 검증하는 용도가 될 수 있음</p><ul><li><a href="https://developer.apple.com/documentation/foundation/urlrequest/2011522-addvalue">addValue(_:forHTTPHeaderField:) | Apple Developer Documentation</a></li><li><a href="https://developer.apple.com/documentation/foundation/urlrequest/2011447-setvalue">setValue(_:forHTTPHeaderField:) | Apple Developer Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18e467a45c08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/alamofire-interceptor%EB%A5%BC-%ED%99%9C%EC%9A%A9%ED%95%9C-%ED%86%A0%ED%81%B0-%EC%9E%AC%EB%B0%9C%EA%B8%89-%EA%B5%AC%ED%98%84-feat-retry-%EB%AC%B4%ED%95%9C-%EB%A3%A8%ED%94%84-%ED%95%B4%EA%B2%B0%EA%B8%B0-18e467a45c08">[Alamofire] Interceptor를 활용한 토큰 재발급 구현(feat. retry 무한 루프 해결기)</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[initialization 톺아보기(4) — Failable Initializers, required Initializers]]></title>
            <link>https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-4-failable-initializers-required-initializers-27bde5c051da?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/27bde5c051da</guid>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 13:45:29 GMT</pubDate>
            <atom:updated>2024-06-01T13:45:29.578Z</atom:updated>
            <content:encoded><![CDATA[<h3>initialization 톺아보기(4) — Failable Initializers, required Initializers</h3><p>지난 글 목록<br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559">initialization 톺아보기(1) — 값 타입 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">initialization 톺아보기(2) — 클래스 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-3-2%EB%8B%A8%EA%B3%84-%EC%B4%88%EA%B8%B0%ED%99%94%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%83%81%EC%86%8D-d3dd25ec3e1b">initialization 톺아보기(3) — 2단계 초기화와 클래스 상속</a></p><p>안녕하세요, 윤돌이입니다. 오늘은 드디어 초기화 마지막 글입니다!!</p><p>사실 최근 위젯 개발을 하게 되어서 위젯 개발과 관련된 내용을 포스팅 하고 싶었는데, 생각보다 초기화 내용이 많네요,,ㅎㅎㅎ<br>드디어 다음주가 되면 위젯 개발기를 포스팅 할 수 있습니다! 우하하</p><p>오늘 다룰 내용은 두 가지 입니다.</p><ol><li>실패 가능한 초기화 구문(Failable Initializers)</li><li>필수 초기화 구문(Required Initializers)</li></ol><h3>실패 가능한 초기화 구문(Failable Initializers)</h3><p>실패 가능한 초기화 구문은 초기화가 실패할 경우 nil을 반환하는 init 구문입니다.</p><p>쉽게 말해 초기화의 옵셔널 버전이라고 생각하면 되어요!</p><p>아래 예시는 문자열을 숫자로 변환하는 예시입니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DPOhXjDk1-v4jP_T_81K6g.png" /></figure><p>이전에 작성한 내용을 바탕으로 생각해보면 원래는 초기화가 되지 않아 컴파일 시점에서 오류가 발생해야 하잖아요?-?</p><p>하지만 실패 가능한 초기화 구문을 사용하면 오류가 발생하지 않고 nil을 반환하게 됩니다.</p><h4>1️⃣ init?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*xDO_bVS6EEXCReLeyQti6A.png" /><figcaption>int의 실패 가능한 초기화 구문</figcaption></figure><p>여기 보이는 것처럼 실패 가능한 초기화 구문은 뒤에 `?`를 붙여줘야 해요.</p><pre>struct Animal {<br>    let species: String<br>    init?(species: String) {<br>        if species.isEmpty { return nil }<br>        self.species = species<br>    }<br>}</pre><p>실패 가능한 초기화 구문은 return nil을 통해 실패 가능 시점을 나타냅니다.</p><p>공식 문서의 예제를 보면 species 프로퍼티가 빈 문자열인 경우 초기화가 실패하여 `return nil`을 해주고 있어요.</p><pre>let someCreature = Animal(species: &quot;Giraffe&quot;)<br><br>if let giraffe = someCreature {<br>    print(&quot;An animal was initialized with a species of \(giraffe.species)&quot;)<br>}</pre><p>실제 사용을 한다면 이런식으로 사용할 수 있겠죠?</p><p>여기서 주의할 점 두 가지가 있습니다!</p><p><strong>첫째, 실패 가능한 초기화 구문과 실패 불가능한 초기화 구문은 같은 파라미터와 같은 이름으로 정의할 수 없습니다.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dESlWemW7GBBgq5Z_vlglQ.png" /></figure><p>같게 정의한 경우 중복 정의 에러 메세지가 발생합니다.</p><p><strong>둘째, init이 반환값을 갖는 것은 아니다!</strong></p><p>init에서 return값을 명시해주면</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xkm-S_Q6OLKU-Pa--vf6fg.png" /></figure><p><strong>‘nil’ is the only return value permitted in an initializer </strong>라는 오류 메세지를 볼 수 있습니다.</p><h4>열거형에서의 실패 가능한 초기화 구문</h4><pre>enum TemperatureUnit {<br>    case kelvin, celsius, fahrenheit<br>    init?(symbol: Character) {<br>        switch symbol {<br>        case &quot;K&quot;:<br>            self = .kelvin<br>        case &quot;C&quot;:<br>            self = .celsius<br>        case &quot;F&quot;:<br>            self = .fahrenheit<br>        default:<br>            return nil<br>        }<br>    }<br>}</pre><p>열거형에서도 클래스, 구조체와 마찬가지로 실패 가능한 초기화 구문을 사용할 수 있습니다.</p><p>여기서 정해진 case가 아닌 경우에는 return nil을 해주고 있어 K, C, F가 아니라면 초기화에 실패한다는 것을 의미합니다.</p><h4>열거형에서 rawValue를 사용하는 경우</h4><p>열거형은 기본적으로 init?(rawValue:)라는 초기화 구문을 가지고 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjdP6uW8zjYv7nXEc_caQw.png" /></figure><p>이렇게 case에 존재하지 않는 rawValue 값을 사용하는 경우 초기화에 실패하여 nil을 반환해주고 있어요.</p><p>그리고 여기서 보면 실패가능한 초기화 구문의 반환값은 옵셔널 타입인 것도 확인할 수 있습니다!</p><h4>2️⃣ init!</h4><p><em>암시적으로 언래핑된 옵셔널 인스턴스를 생성하는 초기화 구문이다.</em></p><p>라고 문서에 나와있는데,, 암시적으로 언래핑된 옵셔널 인스턴스가 뭐지, ,</p><p>흠냐,, 직접 init!을 생성해봅시다!</p><pre>class Test {<br>    var name: String<br>    init?() {<br>        self.name = &quot;hi&quot;<br>    }<br>    <br>    init!(name: String) {<br>        if name.isEmpty { return nil }<br>        self.name = name<br>    }<br>}<br><br>let a: Test = Test.init(name: &quot;&quot;)<br>let b: Test = Test.init(name: &quot;윤돌&quot;)<br>let c: Test = Test.init()<br>print(type(of: a))<br>print(type(of: b))<br>print(type(of: c))</pre><p>여기서 a, b는 init!를 사용하여 만든 인스턴스이고 c는 init?을 활용했습니다. 이때 변수의 타입을 옵셔널이 아니라 Test로 고정해주었어요!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UtB6M-rRjWE67WfBBZhcAw.png" /></figure><p>그러면 c에서만 오류가 발생하는 것을 볼 수 있습니다. Test? 타입은 언래핑 되어야 Test가 된다고 해요.</p><p>앞에서 실패가능한 초기화를 사용하면 옵셔널 타입으로 반환이 된다고 했는데요, init!을 사용하면 특정 조건에 따라 옵셔널이 아닌 값으로 반환이 됩니다.</p><p>만약 타입 지정 없이 init!을 사용하여 인스턴스를 만들면 어떻게 될까요?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YI8FlhtB-c6RwXc8mhFYBA.png" /></figure><p>타입지정을 해준 경우에는 Test로, 타입지정을 해주지 않은 경우에는 옵셔널 값으로 인스턴스가 생성되는 것을 볼 수 있습니다.</p><p>정리하자면 실패 가능한 초기화 중에서도 타입 지정을 해주었을 때 옵셔널이 아닌 인스턴스가 반환되는 초기화 입니다.</p><h4>3️⃣ 실패 가능한 초기화의 오버라이딩</h4><p>실패 가능한 초기화 구문 → 실패 불가능한 초기화 구문으로 재정의 가능<br>실패 불가능한 초기화 구문 → 실패 가능한 초기화 구문으로 재정의 불가!</p><p>다시 말하면 init?은 override init으로 재정의 가능하지만, init은 override init?으로 재정의가 불가능합니다.</p><pre>class Fruits {<br>    var name: String<br>    <br>    init() {<br>        self.name = &quot;watermelon&quot;<br>    }<br>    <br>    init?(name: String) {<br>        if name.isEmpty { return nil }<br>        self.name = name<br>    }<br>}<br><br>class Apple: Fruits {<br>    override init(name: String) {<br>        super.init()<br>    }<br>}<br><br>let apple = Apple(name: &quot;&quot;)<br>print(apple.name)              // &quot;watermelon&quot;</pre><p>이렇게 빈 문자열이 전달되어도 super.init()을 통해 name이 초기화 될 수 있습니다.</p><p>만약 하위 클래스에서 실패 가능한 초기화를 호출하고 싶을 때는 초기화 구문을 강제언래핑 해주면 됩니다!</p><pre>class Apple: Fruits {<br>    override init(name: String) {<br>        super.init(name: name)!<br>    }<br>}</pre><h3>필수 초기화 구문(required init)</h3><p>말 그대로 필수로 정의해야하는 초기화 구문입니다. 필수로 생성해야하는 초기화의 경우 슈퍼 클래스에서 required를 붙이면 서브 클래스에서도 반드시 구현해주어야 하는 것이죠!!</p><pre>class Fruits {<br>    var name: String<br>    <br>    init() {<br>        self.name = &quot;watermelon&quot;<br>    }<br>    <br>    required init?(name: String) {<br>        if name.isEmpty { return nil }<br>        self.name = name<br>    }<br>}<br><br>class Apple: Fruits {<br>    required init(name: String) {<br>        super.init(name: name)!<br>    }<br>}</pre><p>required 키워드를 사용하면 init에 override 키워드를 붙이지 않아도 됩니다.</p><h4>+) 추가</h4><p>여기까지 읽으셨다면 이제 required init?을 이해할 수 있습니다!!</p><pre>required init(coder: NSCoder) {<br>        fatalError(&quot;init(name:) has not been implemented&quot;)<br>    }</pre><p>Cell과 UIView 등을 만들 때 override init을 생성해주면 항상 요 친구를 필수적으로 적어주어야 한다고 오류가 발생하잖아요?-?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*-3B3KFKm9T0xcJMCixvb8w.png" /></figure><p>바로 이 NSCoding 때문입니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Xs15GW1P5S5ZCIAdhJyCQ.png" /></figure><p>UICollectionViewCell도 UICollectionReusableView를 상속받지만 UICollectionReusableView가 UIView를 상속받기 때문에 마찬가지로 NSCoding을 상속받는다 할 수 있습니다.</p><h4>NSCoding이 뭔데?</h4><p>우리가 뷰를 구현하는 방법은 xib나 storyboard를 사용하여 그리는 방법과 코드로 구현하는 방법 두 가지가 존재합니다.</p><p>이때 xib와 storyboard 파일은 xml 형태로 저장이 되는데, 이 파일 구성을 가져오는 작업을 <strong>init(coder: NSCoder)</strong>가 해주고 있어요!</p><p>우리가 xib와 storyboard를 사용하는 경우에는 따로 designated init을 생성하지 않으니 자동으로 슈퍼클래스의 <strong>required init(coder: NSCoder) </strong>상속받게 됩니다.</p><p>하지만 코드로 뷰를 구현하는 경우에는 designated init을 새로 구현하게 되고 이렇게 되면 부모 클래스의 생성자를 상속받지 않게 되기 때문에 따로 <strong>required init?(corder: NSCoder)</strong>를 명시적으로 생성해줘야 하는 것이죠!!</p><p>더 자세한 설명은 <a href="https://jeonyeohun.tistory.com/359">여기</a>를 참고해주세요,,</p><p>드디어 초기화 끝! 다음에는 위젯 개발로 돌아오겠습니다~!</p><p>출처: <a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization#Failable-Initializers">https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization#Failable-Initializers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27bde5c051da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-4-failable-initializers-required-initializers-27bde5c051da">initialization 톺아보기(4) — Failable Initializers, required Initializers</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[initialization 톺아보기(3) — 2단계 초기화와 클래스 상속]]></title>
            <link>https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-3-2%EB%8B%A8%EA%B3%84-%EC%B4%88%EA%B8%B0%ED%99%94%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%83%81%EC%86%8D-d3dd25ec3e1b?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3dd25ec3e1b</guid>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 11 May 2024 14:58:13 GMT</pubDate>
            <atom:updated>2024-05-11T15:28:13.809Z</atom:updated>
            <content:encoded><![CDATA[<h3>initialization 톺아보기(3) — 2단계 초기화와 클래스 상속</h3><p>안녕하세요 윤돌이입니다! 다음 글을 예고하고 거의 한 달만에 글을 작성하게 되었네요,,ㅋㅋ</p><p>거두절미하고 시작해보겠습니다.</p><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559">initialization 톺아보기(1) — 값 타입 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">initialization 톺아보기(2) — 클래스 초기화</a></p><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">지난글</a>에서는 클래스의 초기화에 대해 정리했습니다. 간단히 요약하자면,</p><ol><li>클래스는 값 타입과 다르게 memberwise 초기화를 제공하지 않기 때문에 프로퍼티가 초기화되지 않는 경우 반드시 초기화 구문이 필요하다.</li><li>클래스의 초기화는 designated init과 convenience init 두가지로 나뉜다.</li><li>designated inie은 기본적으로 사용하는 초기화 구문을 의미하고 conveninece init은 필수가 아니다.</li></ol><p>정도가 되겠습니다.</p><p>오늘 다룰 내용은 클래스의 2단계 초기화와 클래스 상속입니다.</p><h3>2단계 초기화</h3><p>클래스의 초기화는 2단계로 구성되어있습니다. 각 단계에서 하는 일은 다음과 같습니다.</p><p>1단계: 클래스의 모든 저장된 프로퍼티에 초기값이 할당된다.</p><p>2단계: 모든 프로퍼티의 초기값이 결정되면 인스턴스 사용 준비를 완료하기 전에 프로퍼티를 사용자화 할 수 있다.</p><p>조금 더 구체적으로 알아봅시다!</p><h4>1단계</h4><p>먼저 designated init 또는 convenience init이 클래스에서 호출됩니다. 그러면 클래스의 새로운 인스턴스를 위한 메모리 공간이 할당되고, 이 메모리는 아직 초기화 되기 전입니다.</p><p>그리고 클래스의 designated init이 호출되면 모든 지정 프로퍼티가 값을 가지고 있는지 확인하게 됩니다.</p><p>자신의 프로퍼티 값이 모두 초기화 된걸 확인하면 슈퍼클래스의 초기화 함수를 호출합니다.</p><p>이 작업은 최상위 슈퍼 클래스에 도달할 때까지 반복되고 최상위 클래스도 모든 프로퍼티가 초기화 된 것을 확인하면 비로소 메모리가 완벽히 초기화 되었다고 간주하여 1단계가 완료됩니다.</p><p>즉, <em>내 클래스의 designated init 호출 -&gt; 슈퍼클래스의 init 호출 </em>이 과정이 최상위 클래스까지 반복된다는 말인데요,</p><p>.. 너무 긴 것 같지만!! 코드로 알아봅시다.</p><pre>class Continent {<br>    var name: String<br>    <br>    init(name: String) {<br>      self.name = name<br>    }<br>}<br><br>class Asia: Continent {<br>    var direction: String<br>    <br>    init(direction: String) {<br>      self.direction = direction<br>      super.init(name: &quot;Asia&quot;)<br>    }<br>}<br><br>class Korea: Asia {<br>    var language: String<br>    <br>    init(language: String) {<br>      self.language = language<br>      super.init(direction: &quot;East&quot;)<br>    }<br>}</pre><p>상속 관계를 가지는 세 개의 클래스를 만들어보았습니다. 1단계 초기화를 해봅시다!</p><ol><li>Korea가 자신의 designated init인 init(language:String)을 호출한다.</li><li>프로퍼티인 language가 초기화 되고 Korea의 모든 프로퍼티가 초기화되었으므로 슈퍼클래스의 init인 super.init(direction:)을 호출한다.</li><li>Asia는 init(direction:)에 의해 프로퍼티 모든 프로퍼티가 초기화된다. 따라서 슈퍼 클래스의 init인 super.init(name:) 을 호출한다.</li><li>Continent의 designated init이 호출되어 name이 초기화 된다.</li><li>최종 슈퍼클래스인 Continent까지 모두 초기화되었으므로 인스턴스의 메모리가 완전히 초기화되며 1단계 초기화가 종료된다.</li></ol><p>✅ 추가</p><p>만약 클래스의 프로퍼티가 옵셔널 타입의 변수이거나 기본값을 가진 프로퍼티인 경우 init에서 초기화 값을 정해주지 않으면 옵셔널 프로퍼티는 nil로, 기본값을 가진 프로퍼티는 기본값으로 초기화 됩니다!</p><p>1단계 초기화를 그림으로 표현하면 아래와 같습니다!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iD_3IaH4LfVTh5fQ3e3VAg.png" /></figure><h4>2단계</h4><p>2단계는 1단계 초기화 완료 이후 진행됩니다.</p><p>1단계와 반대로 최상위 ➡️ 하위뷰로 진행되며 각 클래스의 designated init은 인스턴스를 사용자 정의할 수 있습니다.</p><ul><li>초기화 구문에서 self 로 접근 가능</li><li>프로퍼티를 수정 가능</li><li>인스턴스 메서드를 호출할 수 있음</li><li>모든 클래스에 있는 convenience init은 인스턴스를 사용자화 하고 self 를 사용할 수 있음</li></ul><p>2단계 초기화를 그림으로 표현하면</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oMRI_-4AC1IEla6unI_fKA.png" /></figure><p>반대로 내려오며 인스턴스를 사용자화하게 됩니다!</p><p>즉, 슈퍼클래스의 designated init이 종료되면 서브클래스의 designated init이 추가적인 커스텀을 할 수 있게 되어요. 이때 인스턴스 사용자화는 필수는 아닙니다!</p><p>서브클래스의 designated init이 종료되면 원래 호출되었던 convenience init이 인스턴스를 사용자화 할 수 있으며 마찬가지로 필수가 아닙니다.</p><h4>2단계 초기화를 하는 이유</h4><p>그렇다면 Swift는 왜 초기화를 2단계로 나누었을까요?</p><pre>class Korea: Asia {<br>    var language: String<br>    <br>    init(language: String) {<br>      self.language = language<br>      print(direction)   // Error‼️<br>      super.init(direction: &quot;East&quot;)<br>    }<br>}</pre><p>해당 코드를 살펴볼게요. Korea의 designated init에서는 Korea의 프로퍼티인 language를 초기화하고 있습니다.</p><p>하지만 여기서 super.init을 호출하기 전에 슈퍼클래스의 프로퍼티를 사용하여 문제가 발생합니다.</p><p>따라서 2단계 초기화는 서브 클래스가 deisgnated init에서 상속받은 프로퍼티에 접근하기 전에 슈퍼 클래스의 초기화를 먼저 호출(위임)하도록 하여 이처럼 프로퍼티가 초기화 되기 전에 접근하여 사용되는 것을 방지합니다.</p><p>convenience init 또한 프로퍼티에 접근하기 전에 다른 init을 먼저 호출해야합니다.(위임)</p><p>또한 다른 초기화에 의해 값이 덮어씌워지는 문제도 방지할 수 있습니다.</p><h3>초기화 구문 상속과 재정의 (Initializer Inheritance and Overriding)</h3><p>Obj-c와 다르게 Swift는 기본적으로 서브클래스가 슈퍼클래스의 초기화 구문을 상속하지 않습니다.</p><p>적절한 경우에 따라 슈퍼클래스의 init을 상속합니다.</p><p>이 경우에 대해 알아보기 전에 먼저 override 키워드에 대해 알아보겠습니다!</p><h4>Override</h4><p>Swift에서는 슈퍼클래스의 designated init과 일치하는 하위클래스의 초기화 구문을 작성할 때 하위클래스에서 designated init을 재정의할 수 있습니다.</p><p>이 경우 하위클래스의 init 구문 앞에 override 키워드를 사용해야 합니다.</p><p>초기화 구문 뿐만아니라 재정의 된 프로퍼티, 메소드 또는 서브 스크립트도 마찬가지로 재정의된 경우 override를 작성해주어야 합니다.</p><p>서브클래스의 convenience init이더라도 슈퍼클래스의 init을 재정의한 것이라면 override가 필요합니다.</p><p>단, 슈퍼클래스의 convenience init은 서브클래스에서 직접적으로 호출할 수 없으므로 슈퍼클래스의 convenience init과 같은 초기화구문을 서브클래스에서 구현할 땐 override를 붙이지 않습니다‼</p><p>정리하자면,</p><ol><li>상위 클래스의 designated init, 프로퍼티, 메소드, 서브 스크립트를 재정의할 때 ➡️ override 필수</li><li>서브 클래스에서 convenience init으로 슈퍼 클래스의 designated init을 재정의 하는 경우 ➡️ override 필수</li><li>슈퍼 클래스의 convenience init과 같은 초기화 구문을 서브 클래스에서 재정의 하는 경우 ➡️ 슈퍼클래스의 convenience init은 서브클래스에서 직접적으로 호출 할 수 없으므로 override 사용 X</li></ol><p>로 요약할 수 있습니다.</p><pre>class Vehicle {<br>    var numberOfWheels = 0<br>    var description: String {<br>        return &quot;\(numberOfWheels) wheel(s)&quot;<br>    }<br>}<br><br>class Bicycle: Vehicle {<br>    override init() {<br>        super.init()<br>        numberOfWheels = 2<br>    }<br>}</pre><p>이 예시에서 Vehicle 클래스는 모든 프로퍼티에 기본값이 존재하여 초기화되었기 때문에 기본 초기화 구문이 자동으로 생성됩니다.</p><p>Vehicle을 상속받은 Bicycle의 init은 슈퍼 기본 초기화 구문과 동일하기 때문에 override 키워드가 붙게 됩니다!</p><p>이해가 되셨나요?</p><p>super.init으로 Vehicle의 초기화를 호출하게 되면 numberOfWheels = 2 가 실행되어 2단계 초기화 구문으로 프로퍼티를 수정하게 되겠네요!</p><p>만약 서브클래스에서 2단계 초기화에 의해 프로퍼티 값이 수정되지 않고 슈퍼 클래스가 동기적이며 Bicycle처럼 인수가 없는 init을 가진다면 super.init을 생략할 수도 있습니다.</p><p><em>추가: 상위 클래스의 초기화 구문이 비동기적이라면 명시적으로 await super.init()을 작성해야 합니다.</em></p><pre>class Hoverboard: Vehicle {<br>    var color: String<br>    init(color: String) {<br>      self.color = color<br>      // super.init() implicitly called here<br>    }<br>    <br>    override var description: String {<br>      return &quot;\(super.description) in a beautiful \(color)&quot;<br>    }<br>}</pre><p>두 번째 예시는 init 대신 프로퍼티를 재정의하고 있습니다. 여기서는 앞서 말한 것처럼 슈퍼 클래스의 프로퍼티를 수정하지 않기 때문에 super.init()를 생략하여 암묵적으로 호출하고 있네요:)</p><h4>자동 초기화 구문 상속(Automatic Initializer Inheritance)</h4><p>다시 본 주제로 돌아와서, Swift에서 자동으로 초기화 구문을 상속하는 2가지 경우에 대해 이야기 해봅시다.</p><p>Swift에서 서브 클래스가 상위 클래스의 초기화 구문을 자동으로 상속받는 경우는 다음과 같습니다.</p><ol><li>하위 클래스가 designated init 구문을 정의하지 않은 경우</li><li>하위 클래스가 1번에 따라 상속하거나 모든 상위 클래스의 designated init 구현을 제공하는 경우</li></ol><p>이 두 가지 규칙을 하위 클래스가 convenience init을 추가할 때도 마찬가지로 적용됩니다.</p><ol><li><strong>하위 클래스가 designated init 구문을 정의하지 않은 경우</strong></li></ol><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">지난 글</a>에서 designated init을 구현하지 않아도 되는 경우는 모든 프로퍼티가 초기화 된 경우라고 했습니다!</p><pre>class Animal {<br>    var name: String<br>    <br>    init(name: String) {<br>      self.name = name<br>    }<br>}<br><br><br>class Dog: Animal {<br>  var type: String = &quot;진돗개&quot;<br>  var age: Int?<br>}</pre><p>프로퍼티가 init 없이 초기화되는 경우는 프로퍼티가 옵셔널 타입이거나 초기값을 갖는 경우라고 했습니다.</p><p>따라서 위 예제에서 Dog 클래스는 Animal의 init을 자동으로 상속받게 됩니다!</p><pre>Dog.init(name: &quot;멍멍이&quot;)</pre><p>따라서 Dog는 designated init이 없어도 이렇게 사용할 수가 있는 것이지요.</p><p>만약 Dog에서 따로 designated init를 생성했다면 Dog의 init()이 사용되겠죠?</p><p><strong>2. 하위 클래스가 1번에 따라 상속하거나 모든 상위 클래스의 designated init 구현을 제공하는 경우</strong></p><p>1번 조건에 의해 모든 designated init을 상속받은 경우, 또는 모든 designated init을 오버라이딩 한 경우에는 자동으로 슈퍼 클래스의 모든 convenience init이 상속됩니다.</p><p>예제로 이해해봅시다! 이번 예제는 Swift.org 내용을 그대로 사용했습니다.</p><pre>class Food {<br>    var name: String<br>    init(name: String) {<br>        self.name = name<br>    }<br>    convenience init() {<br>        self.init(name: &quot;[Unnamed]&quot;)<br>    }<br>}</pre><p>Food 클래스는 designated init과 convenience init을 제공하고 있습니다.</p><p>클래스는 구조체와 다르게 기본 memeberwise init을 가지고 있지 않기 때문에 name 프로퍼티를 초기화하는 designated init을 구현했습니다.</p><p>Food는 convenience init 내부에서도 designated init으로 초기화를 위임하여 name 프로퍼티를 초기화하고 있습니다.</p><p>그림으로 도식화 하면 아래와 같겠네요!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUHKkzfsSEnJqm_4inX9cQ.png" /></figure><pre>let meet = Food()<br>// name: [Unnamed]</pre><p>만약 convenience init으로 초기화를 한다면 name 프로퍼티의 상태는 Unnamed가 될거예요.</p><p>이번에는 Food 클래스를 상속받는 RecipeIngredient를 만들어봅시다.</p><pre>class RecipeIngredient: Food {<br>  var quantity: Int<br>  <br>  init(name: String, quantity: Int) {<br>    self.quantity = quantity<br>    super.init(name: name)          // 2단계 초기화 중 1단계 만족<br>  }<br>  <br>  override convenience init(name: String) {<br>    self.init(name: name, quatity: 1)<br>  }<br>}</pre><p>마찬가지로 2개의 초기화 구문을 제공하고 있습니다.</p><p>RecipeIngredient는 인스턴스의 모든 프로퍼티를 초기화할 수 있는 designated init을 가지고 있습니다.</p><p>우선 quantity로 서브 클래스의 프로퍼티를 초기화 하고 name을 슈퍼클래스의 init으로 위임하여 슈퍼 클래스의 프로퍼티도 초기화하기 때문이에요.</p><p>서브 클래스는 init(name:)이라는 convenience init도 제공합니다. quantity = 1로 기본값을 제공하여 여러 개의 인스턴스가 같은 quantity를 갖는 경우 편리하게 생성할 수 있어요.</p><p>이때 convenience init은 슈퍼클래스의 designated init을 재정의하기 때문에 반드시 override 키워드를 붙여주어야 합니다!!</p><p>서브 클래스의 두 가지 초기화 구문은 conveniecne init으로 init(name: String)을 제공하지만 슈퍼 클래스의 모든 designated init 구현도 제공했기 때문에 2번째 조건을 만족하게 되어 자동으로 슈퍼 클래스의 convenience init을 상속받게 됩니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fi7H4nxCuXuBXCN9UgNuJw.png" /></figure><p>따라서 RecipeIngredient는 세 가지의 초기화 구문을 사용할 수 있습니다.</p><pre>let oneMysteryItem = RecipeIngredient()                      // 슈퍼클래스의 convenience init<br>let oneBacon = RecipeIngredient(name: &quot;Bacon&quot;)               // 서브클래스의 convenience init<br>let sixEggs = RecipeIngredient(name: &quot;Eggs&quot;, quantity: 6)    // 서브클래스의 designated init</pre><p>정말 마지막으로 RecipeIngredient를 상속받는 클래스를 하나 더 만들어볼게요.</p><pre>class ShoppingListItem: RecipeIngredient {<br>    var purchased = false<br>    var description: String {<br>        var output = &quot;\(quantity) x \(name)&quot;<br>        output += purchased ? &quot; ✔&quot; : &quot; ✘&quot;<br>        return output<br>    }<br>}</pre><p>purchased와 description의 모든 초기값이 지정되어있기 때문에 초기화 구문을 정의하지 않아도 에러가 발생하지 않습니다.</p><p>따라서 1번 조건을 만족하게 되어 자동으로 상위 클래스의 모든 designated init과 convenience init을 상속받게 됩니다!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mCQs0mSng-gtMHJKqjBOBA.png" /></figure><p>모두 이해가 잘 되셨나요..?</p><p>여기까지 2단계 초기화와 초기화 상속에 관련된 내용을 다루어보았습니다!! 내용이 정말 많네요,, 하ㅏㅏ하</p><p>다음 글에서는 실패 가능한 초기화 구문과 필수 초기화 구문에 대해 다뤄보겠습니다!</p><p>다음주 토요일에 만나요~</p><p>참고</p><p><a href="https://bbiguduk.gitbook.io/swift/language-guide-1/initialization#default-initializers">https://bbiguduk.gitbook.io/swift/language-guide-1/initialization#default-initializers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3dd25ec3e1b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-3-2%EB%8B%A8%EA%B3%84-%EC%B4%88%EA%B8%B0%ED%99%94%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%83%81%EC%86%8D-d3dd25ec3e1b">initialization 톺아보기(3) — 2단계 초기화와 클래스 상속</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[initialization 톺아보기(2) — 클래스 초기화]]></title>
            <link>https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd0886f36402</guid>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 13 Apr 2024 14:50:39 GMT</pubDate>
            <atom:updated>2024-05-11T15:29:08.177Z</atom:updated>
            <content:encoded><![CDATA[<h3>initialization 톺아보기(2) — 클래스 초기화</h3><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559">initialization 톺아보기(1) — 값 타입 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">initialization 톺아보기(2) — 클래스 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-3-2%EB%8B%A8%EA%B3%84-%EC%B4%88%EA%B8%B0%ED%99%94%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%83%81%EC%86%8D-d3dd25ec3e1b">initialization 톺아보기(3) — 2단계 초기화와 클래스 상속</a></p><p>안녕하세요 토요일 윤돌이입니다-! 오늘은 initialization의 두번째 내용으로 클래스 초기화에 대해 이야기하려고 해요.</p><p>원래는 클래스 초기화의 모든 내용을 정리하려 했으나 토요일이 얼마 남지 않은 관계로ㅎㅎ ,, 클래스 초기화의 절반 내용만 들고왔습니다!</p><p>오늘은</p><ol><li>designated initializer와 convenience initialzer</li><li>클래스 타입에서의 초기화 위임</li></ol><p>이 두 가지 내용을 다뤄보겠습니다.</p><p>지난 포스팅에서 구조체와 클래스는 <strong><em>초기화 시점에 모든 저장 프로퍼티가 초기값을 가지고 있어야한다</em></strong>고 했습니다!</p><p>지난 글에서 정리한 초기화하는 방법으로는</p><ol><li>프로퍼티를 선언할 때 초기값을 지정하기</li><li>프로퍼티 타입을 옵셔널로 주기</li></ol><p>이 두가지가 있었습니다.</p><p>만약 하나의 프로퍼티라도 이 두 가지 조건 중 하나를 만족하지 않는 경우에는 어떻게 될까요?</p><p>클래스는 구조체와 다르게 memberwise initiailizer가 없어서 반드시 init 구문이 필요합니다. 또한 클래스는 상속이 가능하기 때문에 상속받은 부모 클래스의 프로퍼티까지 모두 초기화해줘야 해요.</p><p>클래스는 모든 저장 프로퍼티가 초기값을 가질 수 있도록 두 가지 초기화 구문을 정의하고 있습니다.</p><ol><li>Designated initializer(지정된 초기화 구문)</li><li>Convenience Initializer(편의 초기화 구문)</li></ol><h3>designated initializer와 convenience initializer</h3><h4>designated initializer</h4><p>designated initializer는 클래스가 주로 사용하는 초기화 구문입니다. 저희가 클래스 만들 때 항상 사용하는 init() 이 바로 designated initializer입니다!!</p><p>designated initializer는 반드시 슈퍼 클래스의 init을 호출해주어야 해요.</p><p>상속받은 클래스가 있다면 슈퍼 클래스의 프로퍼티까지 모두 초기화해주어야 하기 때문이에요.</p><p>클래스는 최소 하나 이상의 designated initiailizer를 제공합니다.</p><pre>init(&lt;#parameters#&gt;) {<br>    &lt;#statements#&gt;<br>}</pre><h4>convenience initializer</h4><p>convenience initializer는 보조 초기화입니다. 보조라는 이름이 붙은만큼 이 초기화구문은 필수가 아니예요.</p><pre>convenience init(&lt;#parameters#&gt;) {<br>    &lt;#statements#&gt;<br>}</pre><p>designated initializer를 도와주는 역할이기 때문에 designated initializer의 파라미터 중 원하는 값을 기본값으로 설정해서 도와주는 역할을 합니다.</p><p>convenience 생성자는 다음과 같은 특징을 가지고 있어요.</p><ol><li>convenience 생성자는 슈퍼 클래스의 생성자를 직접 호출할 수는 없습니다.</li><li>같은 클래스 내에 있는 convenience 생성자나 designated 생성자를 호출해야합니다.</li><li>⭐보조하는 역할이기 때문에 최종적으로는 designated initializer를 반드시 호출해주어야 합니다!</li></ol><p>convenience initailizer를 사용하더라도 최종적으로는 designated initializer를 호출하기 때문에 클래스 내 모든 프로퍼티가 초기화가 가능해지는 것이죠!</p><h3>Initializer Delegation for Class Types</h3><p>지금까지 내용을 정리하자면 아래와 같습니다.</p><ol><li>designated initiailizer는 슈퍼 클래스의 초기화 구문을 호출해야 한다.</li><li>convenience 초기화 구문은 같은 클래스에 있는 다른 init 구문만 호출 가능하다.</li><li>convenience 초기화는 결국 designated initiailizer를 호출하게 되어있다!</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EmPA-NguBtpzoScqqbddzg.png" /></figure><p>이 내용을 그림으로 표현한 것입니다. 그림으로 보니 이해가 더 쉽네요!</p><p>이 그림을 코드로 나타내볼까요?</p><pre>class Machine {<br>    var owner: String<br>    var color: String<br>    <br>    init(owner: String, color: String) {<br>        self.owner = owner<br>        self.color = color<br>    }<br>    <br>    convenience init(owner: String) {<br>        self.init(owner: owner, color: &quot;Silver&quot;)<br>    }<br>    <br>    convenience init() {<br>        self.init(owner: &quot;Yundol&quot;)<br>    }<br>}</pre><pre>class Computer: Machine {<br>    var osType: String<br>    var usedYear: Int<br>    <br>    init(osType: String, usedYear: Int) {<br>        self.osType = osType<br>        self.usedYear = usedYear<br>        super.init(owner: &quot;Yundol&quot;, color: &quot;Black&quot;)<br>    }<br>    <br>    init(usedYear: Int) {<br>        self.osType = &quot;iOS&quot;<br>        self.usedYear = usedYear<br>        super.init(owner: &quot;YundolE&quot;, color: &quot;White&quot;)<br>    }<br>    <br>    convenience init(osType: String) {<br>        self.init(osType: osType, usedYear: 0)<br>    }</pre><p>여기서 주의할 점은 convenience init은 designated init과 파라미터가 완전히 같으면 안됩니다! 보조해주는 역할인데 이미 같은 init이 있으면 사용할 이유가 없으니까요!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FSEYcDKb8_dQP6QfS2hOIw.png" /></figure><p>1, 2, 3번 규칙만 만족한다면 이렇게 복잡한 구조의 initializer 관계도 가질 수 있습니다.</p><p>오늘은 클래스의 초기화 구문인 designated initializer와 convenience initializer 그리고 클래스 내 초기화 구문 위임에 대해 일부 살펴보았습니다!!</p><p>다음 글에서는 클래스 초기화의 나머지 내용에 대해 알아보아요 ~</p><p><a href="https://bbiguduk.gitbook.io/swift/language-guide-1/initialization#initializer-delegation-for-class-types">https://bbiguduk.gitbook.io/swift/language-guide-1/initialization#initializer-delegation-for-class-types</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd0886f36402" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">initialization 톺아보기(2) — 클래스 초기화</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[initialization 톺아보기(1) — 값 타입 초기화]]></title>
            <link>https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/025bc4456559</guid>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 06 Apr 2024 09:02:18 GMT</pubDate>
            <atom:updated>2024-05-11T15:29:28.593Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559">initialization 톺아보기(1) — 값 타입 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-2-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%B4%88%EA%B8%B0%ED%99%94-fd0886f36402">initialization 톺아보기(2) — 클래스 초기화</a><br><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-3-2%EB%8B%A8%EA%B3%84-%EC%B4%88%EA%B8%B0%ED%99%94%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4-%EC%83%81%EC%86%8D-d3dd25ec3e1b">initialization 톺아보기(3) — 2단계 초기화와 클래스 상속</a></p><p>안녕하세요 토요일 윤돌이입니다! 오늘은 Swift의 <strong>Initialization</strong>에 대해 정리해보았습니다.</p><p>항상 사용하지만 한 번도 제대로 정리해본적이 없는 것 같아서 이번 기회에 한 번 짚고 넘어가려해요!</p><p>Initialization 내용은 크게</p><ol><li>Struct(값 타입) Initialization</li><li>Class(참조 타입) Initialization</li><li>failable, required Initialization</li></ol><p>로 세 번에 걸쳐 정리할 예정입니다.</p><p>오늘은 Initialization의 기본과 Struct Initialization에 대해 알아보아요.</p><p>모든 내용은 <a href="https://bbiguduk.gitbook.io/swift/language-guide-1/initialization">Swift.org</a>의 내용을 참고하였습니다!</p><h3>Initializers</h3><p>초기화의 정의를 먼저 알아봅시다.</p><blockquote><em>초기화란 클래스, 구조체, 열거형의 인스턴스를 생성하는 것으로 </em><strong><em>프로퍼티 초기값을 설정</em></strong><em>하고 인스턴스를 사용하기 전에 </em><strong><em>다른 설정을 하는 것도 포함</em></strong><em>됩니다.</em></blockquote><p>중요한 것은 <strong>초기화 시점에 모든 프로퍼티 값이 지정되어있지 않다면 초기화가 실패</strong>된 것으로 인스턴스가 생성되지 않습니다‼️</p><pre>init() {<br>    // 초기화 작업 진행<br>}</pre><h4>저장 프로퍼티의 초기값 설정</h4><p><strong>1️⃣ init을 사용한 초기값 설정</strong></p><p>클래스와 구조체는 인스턴스가 생성되기 전에 <strong>모든 프로퍼티 초기값을 반드시 설정</strong>해야한다고 했습니다.</p><p>예시로 7살 유치원생 친구들을 생성해볼게요.</p><pre>struct Human {<br>    var age: Int<br>    init() {<br>        age = 7<br>    }<br>}<br><br>var kindergartner = Human()<br>print(&quot;유치원생의 나이는 \(kindergartner.age)살 입니다.&quot;)</pre><p>Human 구조체는 age라는 저장 프로퍼티를 하나 가지고 있고 init 구문에서 age의 초기값을 지정해주고 있습니다.</p><p><strong>2️⃣ 프로퍼티 선언시 초기값 설정</strong></p><pre>struct Human {<br>    var age: Int = 7<br>}</pre><p>하지만 이렇게 init을 사용하지 않고도 바로 초기값을 지정해줄 수 있습니다.</p><p>만약에 프로퍼티가 항상 같은 초기값을 갖는 경우 방법2️⃣을 사용하는 것이 더 좋다고 합니다!</p><p>이 방법이 더 명확하고 기본값으로부터 프로퍼티 타입을 유추하기 쉽기 때문이에요.</p><h4>Customaizng Initialization</h4><p>init에 파라미터를 생성하여 값 지정할 수도 있습니다.</p><pre>struct Area {<br>    var shapeArea: Double<br>    <br>    init(rectWidth: Double, rectHeight: Double) {<br>        shapeArea = rectWidth * rectHeight<br>    }<br>    <br>    init (triWidht: Doucle, triHeight: Double) {<br>        shapeArea = (triWidht * triHeight) / 2<br>    }<br>}<br><br>let rectangle = Area(rectWidht: 10.0, rectHeight: 10.0)   // 100.0<br>let triangle = Area(triWidth: 10.0, triHeight: 10.0)      // 50.0</pre><p>init은 메소드 이름이 모두 동일하기 때문에 Initialization의 <strong>파라미터명</strong>이 정말 중요합니다❕<br>따라서 인수라벨이 정의된 경우에는 반드시 사용되어야 해요.</p><p>만약 인수라벨을 사용하고 싶지 않다면 일반 메소드와 같이 언더바(_) 를 사용해주세요!</p><pre>init(_ width: Double, _ height: Double) {<br>     shapeArea = rectWidth * rectHeight<br>}</pre><h4>옵셔널 프로퍼티</h4><p>Initialization 과정에서 값을 정할 수 없거나 추후에 지정되는 경우 옵셔널 프로퍼티를 사용할 수 있습니다.</p><p><strong>옵셔널 프로퍼티</strong>는 자동적으로 nil 값을 가지기 때문에 init 구문에서 <strong>초기값을 지정해주지 않아도 됩니다!</strong></p><pre>struct Teacher {<br>    var subject: String?<br>    var name: String<br>    <br>    init(name: String) {<br>        self.name = name<br>    }<br>    <br>    func teacherInfo() {<br>        print(&quot;이름: \(name)&quot;)<br>    }<br>}<br><br>let teacher = Teacher(name: &quot;윤돌이&quot;)<br>teacher.teacherInfo()           // 이름: 윤돌이<br>teacher.subject = &quot;Swift&quot;</pre><p>subject 프로퍼티는 옵셔널 값이기 때문에 init 구문에서 초기화값을 지정하지 않아도 인스턴스를 생성할 수 있습니다.</p><h4>Default Initializers</h4><p>반드시 init이 없어도 기본 초기화가 가능합니다. swift에서는 모든 프로퍼티의 기본값이 지정되어있고 init이 하나도 정의되어있지 않은 경우 기본 initializer를 제공합니다.</p><p>이를 default initializer라고 합니다. default initializer는 모든 프로퍼티가 기본값으로 설정된 새로운 인스턴스를 생성합니다.</p><pre>class Car {<br>    var name: String?<br>    var price = 1000000<br>    var purchased = false<br>}</pre><pre>var car = Car()</pre><p>Car의 모든 프로퍼티는 기본값을 가지고 있고 상속받는 클래스가 없기 때문에 모든 프로퍼티가 기본값을 가지고 있습니다. 옵셔널 값의 경우 nil을 자동으로 할당받게 됩니다!</p><p>따라서 default initializer를 가질 수 있습니다.</p><p>여기까지 기본적인 Initializers의 특징을 살펴보았습니다.<br>이렇다면 이 내용을 바탕으로 구조체 초기화에 대해 알아봅시다🙌</p><h3>Memberwise Initializers</h3><p>구조체의 경우 custom init을 만들지 않으면 자동으로 memberwise initializer를 사용할 수 있습니다.</p><pre>struct Size {<br>    var width = 0.0<br>    var height = 0.0<br>}<br><br>let rectSize = Size(width: 1.0, height: 1.0)</pre><p>Size는 두 개의 프로퍼티를 가지고 프로퍼티는 모두 초기화되어있습니다.</p><p>0.0이라는 초기값을 통해 두 프로퍼티는 Double로 타입추론 되고 init(width: height:)라는 memberwise initializer를 받게 됩니다.</p><p>init()이 없어도 자동으로 모든 프로퍼티의 값을 설정할 수 있도록 해주는 것이죠!</p><p>memberwise initializer는 기본값이 있는 프로퍼티는 생략할 수 있습니다.</p><pre>let circleSize = Size(height: 3.0)<br>let zeroSize = Size()</pre><p>memberwise initializer는 이 밖에도 몇 가지 특징을 가지고 있습니다.</p><p>✅ memberwise initializer는 파라미터가 프로퍼티가 선언된 순서와 개수에 맞게 생성됩니다.</p><pre>struct Size {<br>    var width = 0.0<br>    var height = 0.0<br>}<br><br>let rectSize = Size(height: 1.0, width: 1.0) // ‼️ Error</pre><p>✅ 프로퍼티가 상수로 선언되어있고 이미 초기값을 가진 경우에는 생성자 목록에서 제외됩니다.</p><pre>struct Size {<br>    let width = 1.0<br>    var height = 0.0<br>}<br><br>let rectSize = Size(height: 1.0)</pre><p>✅ 프로퍼티 중 하나라도 private인 경우 memberwise initializer가 제공되지 않습니다.</p><pre>struct Size {<br>    private var width = 1.0<br>    var height = 0.0<br>}<br><br>// memberwise init 제공되지 않음</pre><h3>Initializer Delegation</h3><p>initializer는 인스턴스 초기화를 위해 다른 initializer를 호출할 수도 있습니다. 이를 initializer delegation라고 합니다.</p><p>initializer delegation는 여러 초기화 구문에서 코드가 중복되는 것을 방지해주고 값타입과 참조타입에서 모두 가능합니다.</p><p>값 타입(구조체와 열거형)에서는 상속을 지원하지 않고 initializer delegation을 자신이 제공하는 다른 initializer에만 위임할 수 있기 때문에 간단합니다.</p><pre>struct Human {<br>    var age = 20<br>    var name = &quot;윤돌&quot;<br>}</pre><pre>struct Book {<br>    var price = 0<br>    var name = &quot;Swift&quot;<br>}</pre><pre>struct Reader {<br>    var book = Book()<br>    var human = Human()<br>    <br>    // 1️⃣<br>    init() {}<br><br>    // 2️⃣<br>    init(book: Book, human: Human) {<br>        self.book = book<br>        self.human = human<br>    }<br>    <br>    // 3️⃣<br>    init(book: Book, owner: Human) {<br>        let bookName = &quot;\\(owner.name)이 읽는 책&quot;<br>        let bookPrice = book.price * (100 - owner.age)/100<br>        self.init(book: Book(price: bookPrice, name: bookName), <br>                  human: owner)<br>    }<br>}</pre><p>1️⃣ 첫번째 initializer인 init()은 custom initializer가 없는 경우 사용됩니다. {}에 아무 내용이 없는 빈 본문을 가지게 됩니다.</p><p>이 initializer를 호출하면 Book(price: 0, name: “Swift”)와 Human(age: 20, name: “윤돌”) 기본값으로 초기화되는 Reader()를 반환합니다.</p><pre>let reader = Reader()<br>print(book.price)   // 0<br>print(book.name)    // Swift<br>print(human.age)    // 20<br>print(human.name)   // 윤돌</pre><p>2️⃣ 두번째 initializer인 init(book: human:)은 Reader 구조체에서 custom initializer가 없으면 memberwise initializer와 똑같이 동작합니다.</p><pre>let reader = Reader(book: Book(price: 10000, name: &quot;initializer 공부하기&quot;),<br>										human: Human(age: 25, name: &quot;김춘배&quot;)</pre><p>3️⃣ 세 번째 initializer는 human을 기반으로 book의 프로퍼티값을 지정합니다.</p><p>값 타입의 경우 custom initializer를 작성할 때 같은 값 타입으로부터 다른 initializer를 참조하기 위해 self.init을 사용합니다. self.init 은 초기화 구문 내에서만 호출할 수 있습니다. 실제로 3️⃣번 init 내부에서 self.init으로 2️⃣번 init을 호출하는 것을 볼 수 있습니다.</p><pre>// 3️⃣<br>    init(book: Book, owner: Human) {<br>        let bookName = &quot;\\(owner.name)이 읽는 책&quot;<br>        let bookPrice = book.price * (100 - owner.age)/100<br>        self.init(book: Book(price: bookPrice, name: bookName), <br>                  human: owner)<br>    }<br><br><br>// 인스턴스 생성<br><br>let reader = Reader(book: Book(price: 10000, name: &quot;initializer 공부하기&quot;),<br>   		    owner: Human(age: 25, name: &quot;김춘배&quot;))</pre><p>여기까지 초기화 기본과 값타입에서의 초기화에 대해 알아보았습니다!</p><p>다음주에는 참조 타입의 초기화에 대해 알아보겠습니다.</p><p>오류나 잘못된 내용이 있다면 언제든 댓글로 피드백 부탁드립니다~!</p><p>[참고]</p><p><a href="https://bbiguduk.gitbook.io/swift/language-guide-1/initialization">https://bbiguduk.gitbook.io/swift/language-guide-1/initialization</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=025bc4456559" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/initialization-%ED%86%BA%EC%95%84%EB%B3%B4%EA%B8%B0-1-025bc4456559">initialization 톺아보기(1) — 값 타입 초기화</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[WWDC 22] Meet WeatherKit]]></title>
            <link>https://medium.com/daily-monster/wwdc-22-meet-weatherkit-0a52df4aacfa?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a52df4aacfa</guid>
            <category><![CDATA[weatherkit]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 30 Mar 2024 09:01:56 GMT</pubDate>
            <atom:updated>2024-03-30T09:01:56.635Z</atom:updated>
            <content:encoded><![CDATA[<p>안녕하세요 토요일 윤돌이입니다!</p><p>예전에 날씨앱 클론코딩을 할 때 OpenWeatherMap에 있는 API를 사용해서 이것저것 해보았었는데 Apple의 weatherkit이 있었네요ㅎㅎㅎ</p><p>그럼 애플의 WeatherKit이 무엇인지, 어떻게 사용하는지 알아봅시다.</p><h3>WeatherKit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVb-YHKAESyri3cj4lnnzA.png" /></figure><p>WeatherKit은 애플에서 제공하는 날씨 서비스로 고해상도 날씨 모델, 머신러닝과 예측 알고리즘을 사용해 전세계 날씨를 예측할 수 있는 날씨 서비스입니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CW9U6KbdTTkt0mGrRnAMvw.png" /></figure><p>weatherkit을 사용하면 이렇게 많은 데이터에 접근할 수 있습니다.😲</p><h4>Privacy</h4><p>정확한 날씨 정보를 제공하기 위해서는 사용자의 위치정보가 필요합니다. 위치정보 또한 개인정보이기 때문에 보호가 되어야하는데, WeatherKit을 사용하면 사용자 개인정보 보안도 쉽게 해결할 수 있습니다.</p><ul><li>위치 정보는 일기 예보 제공 목적으로만 사용된다.</li><li>개인 식별 정보와 연관이 없다.</li><li>공유나 판매를 금지한다.</li></ul><p>등과 같이 사용된다고 하네요!</p><h4>Available datasets</h4><p>Apple Weather Service로 다룰 수 있는 6가지 dataset을 알아봅시다.</p><p><strong>current weather</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfP8EBXD-51YO1EAzmn46w.png" /></figure><p>요청된 위치의 “현재” 날씨 상태를 알려줍니다. <strong>단일 시점</strong>을 나타내고 자외선 지수, 온도, 바람과 같은 정보를 알 수 있습니다.</p><p><strong>Minute forecast</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhsU8yoH1gR-cQsF6X8NXw.png" /></figure><p>minute forecast는 비가 내리는지 여부를 판별할 때 사용하는 dataset으로 분별 강수량 조건이 포함됩니다.</p><p><strong>Hourly forecast</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KqGfA-mEq-j3NzMre92dtQ.png" /></figure><p>Hourly forecast는 Current weather와 똑같은 정보를 제공하지만 현재 시간으로부터 최대 240시간 동안의 예보를 제공합니다.</p><p><strong>Daily forecast</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2kM0ASuq-oT_OOvkoqqdwA.png" /></figure><p>최대 10일의 예보가 저장되어있습니다. 최고, 최저 기온, 일몰과 일출 등 하루 전체에 대한 정보를 제공합니다.</p><p><strong>Weather alerts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGr6TybxXch3sViMLBtboQ.png" /></figure><p>발령된 악천후 경보를 포함합니다.</p><p><strong>Historical weather</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0DEV-akyN7L8w2s23vcOxQ.png" /></figure><p>과거 날씨 기록을 제공하여 날씨 추세를 알 수 있습니다. 또한 시간별 또는 일별 시작 날짜와 종료 날짜를 지정할 수 있습니다.</p><h3>Requesting weather</h3><p>WeatherKit에서 REST API를 사용해 날씨 정보를 요청하는 방법에 대해 알아봅시다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSbAt_f8eWNyNfd1o6rRtA.png" /></figure><p>Apple Weather Data는 기본 프레임워크와 REST API 세트를 통해 사용할 수 있습니다.</p><h4><strong>기본 프레임워크로 접근하기</strong></h4><pre>// Request the weather<br><br>import WeatherKit<br>import CoreLocation<br><br><br>let weatherService = WeatherService()<br><br>let syracuse = CLLocation(latitude: 43, longitude: -76)<br><br>let weather = try! await weatherService.weather(for: syracuse)<br><br>let temperature = weather.currentWeather.temperature<br><br>let uvIndex = weather.currentWeather.uvIndex</pre><p>swift concurrency를 사용하여 코드를 작성하면 날씨 요청을 간단하게 할 수 있습니다.</p><ol><li>import Weatherkit, import CoreLocation: 사용할 프레임워크를 import해줍니다.</li><li>let weatherService = WeatherService(): Weather Service의 진입점으로 WeatherService 개체를 만들어줍니다.</li><li>let syracuse = CLLocation(latitude: logitude: ): CLLocation으로 정보를 요청할 현재 위치 좌표를 적습니다.</li><li>let weather = try! await weatherService.weather(for: syracuse): weather를 호출해 생성한 위치를 전달합니다.</li><li>weather에 날씨 정보가 전달되면 앞에서 보았던 datasets에서 필요한 정보를 가져올 수 있습니다.</li></ol><p>사용된 weatherService 객체를 조금 더 알아봅시다.</p><p><strong>WeatherService</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kyIu912NEmBY0SnTr1l9PA.png" /></figure><p>날씨 정보를 제공하기 위한 인터페이스로 class로 구현되어있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jbu5IkRxP4e0E_HPRBIEfA.png" /></figure><p>제공하는 weather 메소드는 다음과 같습니다. for에서 받은 위치 정보에 맞는 날씨 예보를 return해주는 역할을 합니다. 역할은 모두 같고 WeatherQuery의 개수에 따라 메소드 종류를 여러개로 나누었네요!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qnu4uLRkwN9wAFtnRfJ0nQ.png" /></figure><p>이외에 싱글톤 객체 생성을 위한 shared와 저작권 표시를 위한 attribution 프로퍼티를 제공하고 있습니다.</p><p>WeatherKit을 실제로 사용하려면 애플 개발자 계정이 필요합니다.</p><p>월 호출 수 50만건 이하는 개발자 계정이 있다면 무료로 사용 가능하지만 그 이상의 호출이 발생하는 경우 추가 요금을 내야합니다. 요금제 관련 정보는 <a href="https://developer.apple.com/kr/weatherkit/get-started/">해당 링크</a>를 참고해주세요!</p><ol><li>먼저 AppID를 만들고 WeatherKit를 선택해주세요.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*el7LmLydSSvpjVjZLAZAiA.png" /></figure><p>2. Xcode에서 Capabilities로 WeatherKit을 추가해줍니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vffUySbd8FFS-XzuqhoFGQ.png" /></figure><p>그럼 벌써 사용준비가 끝났어요!</p><p>아까 보았던 사용 예시말고 다른 예시를 하나 더 볼게요</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UvMISHC6v5eg50kUumoFHA.png" /></figure><p>forcast 부분을 보면 앞에서 보았던 weatherService의 weather 메소드를 사용하고 있습니다.</p><p>including에 들어갈 수 있는 쿼리 종류는 앞에서 보았던 dataset의 종류와 같습니다.(current, minute, hourly, daily, alerts, availability)</p><p>weatherKit을 사용하는 경우 반드시 애플 저작권 마크를 남겨주어야 합니다.</p><pre>var body: some View {<br>  .task {<br>    do {<br>      let attribution = try await WeatherService.shared.attribution<br>      attributionLink = attribution.legalPageURL<br>      attributionLogo = colorScheme == .light? attribution.combinedMarkDarkURL : attribution.combinedMark:ightURL<br>    }<br>  }<br>}</pre><p>저작권 마크는 weatherService의 attribution을 사용해주세요!</p><h4>REST API 사용하기</h4><p>REST API는 WeatherKit와 모두 동일한 데이터를 가지고 올 수 있고 모든 플랫폼에 사용할 수 있습니다.</p><p>아래 코드는 WeatherKit.apple.com의 엔드포인트에서 날씨 알림을 요청하는 방법입니다.</p><pre>/* Request a token */<br>const tokenResponse = await fetch(&#39;https://example.com/token&#39;);<br>const token = await tokenResponse.text();<br><br>/* Get my weather object */<br>// en-US: 현지화 응답에 적합한 언어 사용<br>// 41.029/-74.642?: 현재 위치<br>// dataSets=weatherAlerts : 원하는 데이터셋 → 복수형이라 쉼표로 구분하여 요청 가능<br>// country=US : 요청한 국가코드 → 날씨 경보를 요청할 때만 필요!<br>const url = &quot;https://weatherkit.apple.com/1/weather/en-US/41.029/-74.642?dataSets=weatherAlerts&amp;country=US&quot;<br><br>// URL과 인증토큰을 사용해 weatherResponse를 JSON로 가져온 후<br>const weatherResponse = await fetch(url, {<br>headers: {<br>&quot;Authorization&quot;: token<br>}<br>});<br><br>// weatherResponse.json()으로 인코딩한다.<br>const weather = await weatherResponse.json();<br><br>/* Check for active weather alerts */<br>const alerts = weather.weatherAlerts;<br>const detailsUrl = weather.weatherAlerts.detailsUrl;</pre><p><strong>WeatherKit을 사용하기 위한 인증토큰</strong>은 Certificates, Identifiers &amp; Profiles &gt; Keys에서 만들 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPT1PeUB1qxfSO_kcsdnXg.png" /></figure><p>키를 만들어준 뒤 identifier에서 WeatherKit을 체크해주세요.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A9fWby6E9_Y5WzPXIiADWQ.png" /></figure><h3>Publishing requirments</h3><p>마지막으로 저작권 표시에 대한 내용입니다. App Store에 올리거나 REST API를 사용했을 때 꼭 해야하며 Swift를 사용하거나 REST API를 사용하는 것에 관계없이 모두 해당되는 내용입니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMyt_ZWW8yyALqlPmYAq1A.png" /></figure><ol><li>네이티브 앱이나 웹 앱에 표시해야하는 attributionLink가 표시합니다.</li><li>Appl Weather Logo 표시해줍니다.</li><li>날씨 경보를 사용하는 경우 response에 제공된 event page에 대한 링크 제공해야합니다.</li></ol><p>오늘은 가볍게 WeatherKit이 무엇이고 어떻게 사용하는지에 대해 알아보았습니다. 다음주는 더 유익한 내용으로 돌아오겠습니다~!</p><p>오류나 틀린 부분은 언제든 댓글 달아주세요! 감사합니다.</p><p>참고</p><p><a href="https://developer.apple.com/kr/weatherkit/get-started/">WeatherKit 시작하기 - Apple Developer</a></p><p><a href="https://developer.apple.com/videos/play/wwdc2022/10003/">https://developer.apple.com/videos/play/wwdc2022/10003/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a52df4aacfa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/wwdc-22-meet-weatherkit-0a52df4aacfa">[WWDC 22] Meet WeatherKit</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privacy manifest files 파일과 Privacy Report 생성하기]]></title>
            <link>https://medium.com/daily-monster/privacy-manifest-files-%ED%8C%8C%EC%9D%BC%EA%B3%BC-privacy-report-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0-63980b20c6d7?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/63980b20c6d7</guid>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[privacy-policy]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 13:47:19 GMT</pubDate>
            <atom:updated>2024-03-23T13:50:27.600Z</atom:updated>
            <content:encoded><![CDATA[<h3>Privacy manifest files 파일과 Privacy Report생성하기</h3><p>안녕하세요 토요일마다 돌아오는 윤돌이입니다! 오늘은 Apple의 개인정보 보호 정책과 관련된 내용을 들고왔습니다.</p><p>✅ Apple에서 2023년에 새로운 개인정보 보호 정책을 발표했습니다. <strong>2024년 5월 1일</strong>부터 privacy manifest 파일에 Required Reason API를 사용한 이유를 설명하지 않는 앱을 허용하지 않는다고 합니다. 이 Required Reason API에는 <strong>UserDefaults</strong>도 포함이 되어있다는 사실❕</p><p>저는 이 사실을 사이드 프로젝트 서버 개발자분을 통해 듣게 되었는데요,, 아무래도 애플 개발자 소식에 조금 더 귀를 귀울여야겠습니다^__^</p><p>5월 1일이 얼마 남지 않은 시점에서 privacy manifest 파일이 정확히 무엇인지, 또 어떻게 적용해야하는지 살펴보아요!</p><h3>Privacy Manifest File</h3><p>privacy manifest file은 수집하는 데이터와 Required Reason API를 사용하는 이유를 명시한 파일입니다.</p><p>privacy manifest file은 property list로 개인이 만든 앱 뿐만 아니라 타사 SDK에서도 수집한 데이터와 API를 사용하는 이유에 대해 명시해야 한다고 해요. 또한 외부 SDK 요구사항에 <em>“privacy manifest와 서명이 필요한 SDK(SDKs that require a privacy manifest and signature)”</em>라고 적혀있다면 외부 SDK에 privacy manifest 파일을 추가해주어야 합니다.</p><p>개인 앱의 privacy manifest file과 사용하는 외부 SDK의 privacy manifest file을 통합하여 privacy report를 만들 수 있습니다.</p><h4>Privacy Manifest File 생성</h4><p>privacy manifest file을 직접 만들어볼게요. 먼저 command + N으로 New File을 열어주세요.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkONcTR5n6chvIg3jYELZg.png" /></figure><p>App Privacy File을 선택합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_t6a2ObZ5DbEYZ39jTbMww.png" /></figure><p>타겟을 잘 선택해주시기만 하면</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*hyCmwcLRz56SE06MTcLUpw.png" /></figure><p>생성됩니다! 기본적으로 file의 이름은 PrivacyInfo.xcprivacy 입니다.</p><p>이 property list 에는 네 가지 속성을 추가할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*56nbL4ku7HGmhwy7uQ6NzQ.png" /></figure><ol><li>NSPrivacyTracking: App Tracking Transparency framework에 정의된 대로 추적을 위해 데이터를 사용하는지 여부를 나타내는 Boolean 값입니다. 더 많은 정보는 <a href="https://developer.apple.com/app-store/user-privacy-and-data-use/">User Privacy and Data Use</a>를 확인하세요.</li><li>NSPrivacyTrackingDomains: 추적에 사용되는 인터넷 도메인을 나열한 String 배열입니다. 만약 유저가 App Tracking Transparency framework를 통해 추적 권한을 주지 않으면 이러한 도메인에 대한 네트워크 요청이 실패하고 App에 오류가 발생합니다.<br>NSPrivacyTracking 를 true 설정했다면NSPrivacyTrackingDomains 에서 최소 하나의 인터넷 도메인을 제공해야합니다. 그렇지 않은 경우 0개 이상의 도메인을 제공할 수 있습니다.</li><li>NSPrivacyCollectedDataTypes : dictionary 배열로 수집하는 데이터 항목을 나타냅니다. 딕셔너리에 있는 key와 value정보를 사용하기 위해서는 <a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests">Describing data use in privacy manifests</a>를 참고해주세요.</li><li>NSPrivacyAccessedAPITypes: dictionary 배열로 접근하는 API 타입을 나타냅니다. API 타입은 Required Reason API로 지정되어있습니다.</li></ol><p>긁적긁적,, 조금 생소하네요.</p><p>Privacy manifest file에서는 수집한 데이터 항목과 Required Reason API에 대한 이유를 명시해야한다고 했으니 수집한 데이터 항목을 명시하는 방법부터 알아봅시다.</p><h3>수집 항목 나타내기(NSPrivacyCollectedDataTypes)</h3><p>수집항목은 Privacy manifest file의 NSPrivacyCollectedDataTypes 을 통해 나타낼 수 있습니다. 딕셔너리 배열 타입으로, 키값으로는 아래와 같은 항목을 사용할 수 있습니다.</p><ul><li>NSPrivacyCollectedDataType : 수집하는 데이터 타입을 식별할 수 있는 String입니다.아래의 데이터 유형 항목에서 앱 또는 타사 SDK가 수집하는 데이터와 일치하는 값을 선택합니다.</li><li>NSPrivacyCollectedDataTypeLinked: 데이터 유형을 사용자의 ID에 연결하는지 여부를 나타내는 Boolean 값입니다. 더 많은 정보는 <a href="https://developer.apple.com/app-store/app-privacy-details/#linked-data">App privacy details on the App Store</a>에서 확인하세요.</li><li>NSPrivacyCollectedDataTypeTracking: 데이터 타입을 추적하는데 사용하는지 여부를 나타내는 Boolean 값입니다.</li><li>NSPrivacyCollectedDataTypePurposes: 데이터를 수집하는 이유를 나열하는 문자열 배열입니다.</li></ul><p>여기서 NSPrivacyCollectedDataType의 key값이 될 수 있는 목록은 <a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests#4250555"><strong>Report the categories of data your app or third-party SDK collects</strong></a> 여기서 확인하실 수 있습니다!</p><p>이렇게 말로만 보면 헷갈리니 직접 한 번 추가해보아요.</p><p>만약 앱 내에서 사용자의 전화번호부 데이터를 사용한다고 가정해볼게요.<br>NSPrivacyCollectedDataType의 key값이 될 수 있는 목록에서 phone number와 관련된 key를 찾아봅니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3nEEbp0VGyXnekDeTmondg.png" /></figure><p>phone number와 관련된 key 값은 NSPrivacyCollectedDataTypePhoneNumber네요!</p><p>그럼 다시 PrivacyInfo 파일로 가서 NSPrivacyCollectedDataTypes 인 Privacy Nutrition Label Types 토글을 열어주시고 새 항목을 추가해주세요.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6EhUuBJv5IRaGZZjvuVjg.png" /></figure><p>새 항목을 추가해주시고 item 토글을 열면 NSPrivacyCollectedDataTypes에서 사용하는 네 가지 항목이 나옵니다.<br>NSPrivacyCollectedDataType 에 우리가 찾은 key값을 넣어주고 Linked to User와 Used for Tracking은 앱 상황에 맞는 boolean 값을 넣어주세요!</p><p>마지막 Collection Purposes는 수집 목적에 관한 항목입니다. 해당 항목에 들어갈 수 있는 내용은 <a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests#4250556">Report the reasons your app or third-party SDK collects data</a> 에서 확인하실 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcB9gSOQqfZbcr0lmaDzWg.png" /></figure><p>24년도 3월 기준 6개의 이유를 제공하고 있습니다.</p><h3>Required Reason API 사용 목적 나타내기(NSPrivacyAccessedAPITypes)</h3><p>API 사용 목적은 NSPrivacyAccessedAPITypes 에서 명시할 수 있습니다.</p><p>핵심 기능을 제공하기 위해 사용하는 일부 API(개발자가 직접 작성한 코드 또는 타사 SDK에 포함되는 일부 API) 잘못 사용될 가능성이 있습니다. 이렇게 오용 또는 남용되는 경우를 핑거 프린팅이라고 불러요.</p><p>사용자가 앱을 추적할 수 있는 권한을 주었는지여부에 관계없이 핑거프린팅은 허용되지 않습니다.</p><p>그렇기 때문에 API를 사용해야하는 이유를 명확히 명시하여 사용자의 privacy를 지켜주는 것이죠!</p><p>NSPrivacyAccessedAPITypes 의 key 값으로는 아래 항목이 있습니다.</p><ul><li>NSPrivacyAccessedAPIType : 앱이 사용하는 필수 API의 카테고리를 식별하는 문자열입니다.</li><li>NSPrivacyAccessedAPITypeReasons: 앱이 API를 사용하는 이유를 식별하는 문자열 배열입니다.</li></ul><p>수집 데이터 항목과 마찬가지로 value값은 <a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api">Describing use of required reason API </a>공식문서에 잘 나와있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*uxxCmZ3R6h72O2-9L1rfgQ.png" /></figure><p>저는 UserDefaults 관련 내용을 찾아보았습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ptq_XGFpzIQ9Kws15tBFg.png" /></figure><p>이렇게 다양한 목적들이 제공되고 있고, 이유에 맞는 value값을 선택에 주시면 됩니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3WPHFqWixgEl5d16SIwGA.png" /></figure><p>이런식으로요!</p><p>만약 매번 공식문서에서 찾아보기 귀찮으신 분들은 오른쪽 가장 끝에 화살표를 클릭하시면 선택 보기를 볼 수 있어요.</p><h3>주의사항</h3><p>이때 간단한 주의사항이 있습니다. 수집된 데이터 항목과 Required Reason API 사용 목적을 나타낼 때에는 공식 문서에서 제공된 항목만을 key값과 value값으로 사용할 수 있어요.</p><p>만약 커스텀 항목을 사용하게 된다면 Privacy manifest files을 사용하여 만드는 privacy report가 제대로 구성되지 않습니다!</p><h3>Privacy Report</h3><p>마지막으로 외부 SDK와 앱 내의 privacy manifest file을 가지고 privacy report를 만들어보겠습니다.</p><ol><li>먼저 Product &gt; Archive로 archive를 해주세요.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SoTH4MApS_nnl5DsnqiPhQ.png" /></figure><p>2. Organizer에서 archive를 control + click하고 Generate Privacy Report(개인정보 보고서 생성)를 선택합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*54lHwqzBydcjeoljm5xrTQ.png" /></figure><p>3. privacy report를 저장할 위치를 선택합니다. 이후 Finder에서 저장 위치에 있는 report를 더블 클릭하여 잘 생성되었는지 확인해주시면 됩니다! <br>이 report를 활용하여 App Strore Connect에서 앱이 수집하는 개인정보를 채워주세요.😃</p><h3>추가</h3><p>Apple에서는 key값과 value값을 정리한 아티클을 지속적으로 업데이트할 예정이라고 합니다!</p><p>또한 외부 SDK에서 명시하지 않은 내용을 내 앱에서 명시할 필요는 없다고 해요.</p><p>다들 5월 1일 전까지 무사히 Privacy manifest files과 Privacy Report를 생성해서 앱 스토어에서 리젝 당하지 않도록 합시다!!🥱</p><p>오타, 오류 지적은 언제나 환영입니다! 그럼 다음주 토요일에 또 만나요~</p><p>참고</p><ul><li><a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files">Privacy manifest files | Apple Developer Documentation</a></li><li><a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests">Describing data use in privacy manifests | Apple Developer Documentation</a></li><li><a href="https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api">Describing use of required reason API | Apple Developer Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63980b20c6d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/privacy-manifest-files-%ED%8C%8C%EC%9D%BC%EA%B3%BC-privacy-report-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0-63980b20c6d7">Privacy manifest files 파일과 Privacy Report 생성하기</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xcode Cloud로 CI/CD 적용하기(2)]]></title>
            <link>https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-2-f8b5bf092899?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8b5bf092899</guid>
            <category><![CDATA[xcode15]]></category>
            <category><![CDATA[xcode-cloud]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 16 Mar 2024 09:02:18 GMT</pubDate>
            <atom:updated>2024-03-16T09:02:18.818Z</atom:updated>
            <content:encoded><![CDATA[<p>안녕하세요 윤돌이입니다! 지난주에 <a href="https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-1-45b74a7ed167">Xcode Cloud로 CI/CD 적용하기(1)</a>에서 오류를 해결하지 않은 채로 글을 마무리 했었습니다.</p><p>오늘은 오류 해결 과정을 정리해보겠습니다.</p><h4>1. SPM 의존성 문제</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lP5TWpU4z4OGJFGM80XYLQ.png" /></figure><p>해당 오류는 SPM 의존성 문제였습니다. Apple 공식문서 <a href="https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud">Making dependencies available to Xcode Cloud</a> 해당 아티클 <a href="https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud#Use-Swift-package-dependencies-and-Git-submodules">Use Swift package dependencies and Git submodules</a>를 살펴보면 원인과 해결 방법이 나와있습니다.</p><p>“CI/CD 환경에서 Swift package dependencies을 사용하는 경우, Xcode Cloud는 automatic package resolution를 사용하지 않고 Package.resolved 파일에 의존하여 dependencies를 해결합니다” 라고 적혀있습니다.</p><p>따라서 프로젝트에서 Swift package dependencies을 사용하는 경우 Package.resolved 파일을 Git repository에 commit해야 한다고 하네요.</p><h4>Automatic Package Resolution</h4><p>SPM(Swift Package Manager)의 기능 중 하나로 개발자가 명시적으로 버전을 지정하지 않아도 SPM이 프로젝트의 의존성을 해결하고 패키지의 적절한 버전을 자동으로 선택할 수 있도록 도와주는 기능입니다!</p><p>그래서 평소 빌드할 때는 의존성 관련 문제가 잘 발생하지 않았나보네요ㅎㅎ</p><p>하지만 Xcode Cloud는 해당 기능을 사용하지 않기 때문에 Package.resolved 파일에 의존한다고 나와있습니다. Package.resolved 파일에 대해서도 알아봅시다.</p><h4>Package.resolved</h4><p>Package.resolved 파일은 dependency해결 결과를 기록하는 파일로 Swift 패키지의 최상위 디렉터리에 저장됩니다. 앱에 Swift 패키지를 패키지 종속성으로 추가하면 .xcodeproj 또는 .xcworkspace 내부에서 Package.resolved 파일을 찾을 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*HDRl73pmfoSPcQQYwK0MRg.png" /></figure><p>프로젝트 파일 우클릭 &gt; 패키지 내용 보기를 선택하면 아래와 같은 파일들이 나옵니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*F88EBongwE7KNeROH7InzQ.png" /></figure><p>워크스페이스에서 우클릭을 하여 다시 한 번 패키지 내용 보기를 클릭해줍니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*mbC7bt3mK-Vm5AVUrRFJ-Q.png" /></figure><p>xcshareddata &gt; swiftpm &gt; Package.resolved 파일을 확인할 수 있습니다.</p><p>Xcode Cloud가 CI/CD를 할 수 있도록 .gitignore에서 Package.resolved를 지워주겠습니다.</p><p>.gitignore 파일을 수정한 다음 아래 명령어를 실행해주세요.</p><pre>git rm -r —cached .</pre><p>해당 명령어는 cache에 기록된 tracking 중인 파일 리스트를 삭제하는 명령어입니다. tracking을 제거해 준 후 git statue를 실행하면 .gitignore에서 제거된 파일이 tracking 됩니다.</p><p>add, commit 후 push까지 해주면 의존성 문제는 해결됩니다!</p><p>.gitignore 파일에 파일을 포함하지 마십시오. 또한 Package.resolved 파일이 $filename.xcodeproj/project.workspace/xcshareddata/swiftpm/Package.resolved에 있는지 확인하십시오.</p><h4>2. .xcconfig 문제</h4><p>의존성 문제 해결 후 다시 빌드를 해보았더니 이번에는</p><p>Unable to open base configuration reference file ‘/Volumes/workspace/repository/pophory-iOS/Debug.xcconfig’.</p><p>해당 에러가 발생했습니다..</p><p>저희 프로젝트에서는 .xcconfig에서 Debug, release 환경에 따라 달라지는 키 값들을 저장하고 있습니다. 외부로 노출되면 안되는 키이기 때문에 repository에 올릴 수 없어 어떻게 해결할지 감이 안 왔는데, <a href="https://medium.com/daily-monster/xcode-cloud-with-xcconfig-ft-%EC%82%BD%EC%A7%88-%EF%B8%8F-4d1aae000604">수요괴물의 DAMIN님 아티클</a> 덕분에 금방 해결할 수 있었습니다!! 🥹 해당 아티클에서는 custom build script로 해당 문제를 해결하였습니다.</p><h4>Custom build script</h4><p>Xcode Cloud는 custom build script를 통해 워크플로우를 확장할 수 있습니다. custom build script는 세 가지 종류가 있습니다. 각 script는 특정 시점에 실행이 됩니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v0ySPtTsHf8Z4hknZnIb_w.png" /></figure><p><em>post-clone scrip:</em> Xcode Cloud가 Git 저장소를 복제한 후 실행</p><p><em>pre-xcodebuild script:</em> Xcode Cloud가 xcodebuild를 실행하기 전에 실행</p><p>post-xcodebuild script : Xcode Cloud가 xcodebuild를 실행한 후 실행</p><p>DAMIN님의 아티클에서는 post-clone script를 통해 Xcode Cloud가 repository를 clone한 후 .xcconfig 파일을 복제할 수 있도록 스크립트를 작성한 것이죠!</p><p>Xcode Cloud가 custom build scripts를 인식하려면 파일이 ci_scripts 디렉토리에 위치해야 합니다.</p><p>그럼 custom build scripts를 만들어 봅시다!</p><ol><li>Xcode에서 프로젝트 또는 워크스페이스를 열어 Project navigator(프로젝트 탐색기)로 이동</li><li>프로젝트 탐색기에서 project를 클릭하여 New Group을 선택하고 새 디렉토리를 만든다.</li><li>새 그룹의 이름은 ci_scripts</li><li>ci_scripts group을 클릭하여 New File을 선택한다.</li><li>Shell Script templete을 선택한다.</li><li>Shell Script의 이름은 ci_post_clone.sh, ci_pre_xcodebuild.sh, or ci_post_xcodebuild.sh 중 하나로 짓는다.</li><li>target을 지정하지 않고 file을 생성한다.</li><li>Terminal에서 chmod +x $filename.sh 를 실행하여 shell script를 실행파일로 만든다.</li><li>첫 번째 줄에 shebang을 포함한 custom build script에 코드를 추가하고 Git 저장소에 코드를 추가한다. Xcode Cloud는 다음 빌드를 시작할 때 자동으로 실행합니다.</li></ol><blockquote>shebang<br>hashbang이라고도 하며 유닉스류 운영 체제에서 스크립트 파일의 시작 부분에 나타나는 문자 시퀀스 “#!”를 말합니다. 스크립트를 실행할 때 사용해야하는 인터프리터를 결정해주는 역할을 합니다.</blockquote><blockquote>shebang 라인이 없으면 스크립트가 올바르게 실행되지 않을 수 있거나, 시스템이 스크립트를 어떻게 실행해야 하는지를 모를 수 있습니다.</blockquote><pre>#!/bin/sh</pre><pre>#  ci_post_clone.sh<br>#  pophory-iOS<br>#<br>#  Created by 윤돌이 on 3/4/24.<br>#</pre><pre># *.xconfig 파일이 생성될 폴더 경로<br>FOLDER_PATH=&quot;/Volumes/workspace/repository/${프로젝트이름}&quot;</pre><pre># PARTS 배열의 두 번째 요소가 &quot;Scheme Name&quot;에 해당<br>IFS=&#39;-&#39; read -ra PARTS &lt;&lt;&lt; &quot;$CI_XCODE_SCHEME&quot;</pre><pre># *.xconfig 파일 이름<br>CONFIG_FILENAME=&quot;${PARTS[1]}.xcconfig&quot;</pre><pre># *.xconfig 파일의 전체 경로 계산<br>CONFIG_FILE_PATH=&quot;$FOLDER_PATH/$CONFIG_FILENAME&quot;</pre><pre># 환경 변수에서 값을 가져와서 *.xconfig 파일에 추가하기<br>echo &quot;BASE_URL = $BASE_URL&quot; &gt;&gt; &quot;$CONFIG_FILE_PATH&quot;<br>echo &quot;UNIT_AD_ID = $UNIT_AD_ID&quot; &gt;&gt; &quot;$CONFIG_FILE_PATH&quot;<br>echo &quot;SENTRY_DSN = $SENTRY_DSN&quot; &gt;&gt; &quot;$CONFIG_FILE_PATH&quot;<br>echo &quot;ADMOB_APP_ID = $ADMOB_APP_ID&quot; &gt;&gt; &quot;$CONFIG_FILE_PATH&quot;</pre><pre># 생성된 *.xconfig 파일 내용 출력<br>cat &quot;$CONFIG_FILE_PATH&quot;</pre><pre>echo &quot;${PARTS[1]}.xcconfig 파일이 성공적으로 생성되었고, 환경변수 값이 확인되었습니다.&quot;</pre><p>여기서 CI_XCODE_SCHEME은 custom build script에서 사용할 수 있는 미리 정의된 환경변수 입니다. 더 다양한 환경변수는 <a href="https://developer.apple.com/documentation/xcode/environment-variable-reference">Environment variable reference</a> 해당 아티클에서 확인하실 수 있습니다.</p><p>또한 워크플로우 관리에서 .xcconfig에서 사용 중인 환경변수를 추가해주세요!</p><h4>3. Xcode 버전 오류</h4><p>custom build script까지 commit 후 다시 CI/CD를 진행하였음에도 제대로 빌드가 되지 않았습니다. 구글링 해보니 Xcode 15.3 업데이트에 따른 오류라고 하더라구요! 그래서 워크플로우에서 Xcode 버전을 수정해주었습니다.</p><p>App Store Connect &gt; Xcode Cloud &gt; 워크 플로우 관리</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqT5KrzOmfa4cp7pd3Mv4A.png" /></figure><p>그럼 CI/CD 구축이 잘 된 것을 확인할 수 있습니다!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QinH5F0qUaMm7E_j_6aCWA.png" /><figcaption>CI/CD 완료 후 동작으로 설정한 notification 알림</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*kFkuOxXGVlsrmxdVT9NNfQ.png" /></figure><p>[참고]</p><ul><li><a href="https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud">Making dependencies available to Xcode Cloud | Apple Developer Documentation</a></li><li><a href="https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#package-dependency">Package - Swift Package Manager</a></li><li><a href="https://developer.apple.com/documentation/xcode/writing-custom-build-scripts">Writing custom build scripts | Apple Developer Documentation</a></li><li><a href="https://zenn.dev/akkii/scraps/8aa0cfe74a7111">Xcode Cloud 突然の大量エラー</a></li><li><a href="https://medium.com/daily-monster/xcode-cloud-with-xcconfig-ft-%EC%82%BD%EC%A7%88-%EF%B8%8F-4d1aae000604">Xcode Cloud with .xcconfig(ft. 삽질⛏️)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8b5bf092899" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-2-f8b5bf092899">Xcode Cloud로 CI/CD 적용하기(2)</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Error] “Failed to load Info.plist]]></title>
            <link>https://medium.com/@dbstj169/error-failed-to-load-info-plist-f86f0c0248ae?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f86f0c0248ae</guid>
            <category><![CDATA[error]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 06:47:23 GMT</pubDate>
            <atom:updated>2024-03-11T06:51:31.112Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Error] “Failed to load Info.plist from bundle at path /Frameworks/$(frameworkname)/Info.plist: No such file or directory”</h3><p>Xcode Cloud 도입 이후 새 기능을 개발하기 위해 오랜만에 프로젝트 빌드를 시도했더니 다음과 같은 오류가 발생했습니다.</p><p><em>나중에 다시 시도하십시오. Failed to load Info.plist from bundle at path /Users/kang-yunseo/Library/Developer/CoreSimulator/Devices/5938A987–13F8–4F3B-8CB0–9C244E5F1057/data/Library/Caches/com.apple.mobile.installd.staging/temp.epvLca/extracted/pophory-iOS.app/Frameworks/GoogleMobileAds.framework; Extra info about “/Users/kang-yunseo/Library/Developer/CoreSimulator/Devices/5938A987–13F8–4F3B-8CB0–9C244E5F1057/data/Library/Caches/com.apple.mobile.installd.staging/temp.epvLca/extracted/pophory-iOS.app/Frameworks/GoogleMobileAds.framework/Info.plist”: Couldn’t stat /Users/kang-yunseo/Library/Developer/CoreSimulator/Devices/5938A987–13F8–4F3B-8CB0–9C244E5F1057/data/Library/Caches/com.apple.mobile.installd.staging/temp.epvLca/extracted/pophory-iOS.app/Frameworks/GoogleMobileAds.framework/Info.plist: No such file or directory</em></p><p>뭐야 제 프로젝트 돌려줘요..</p><p>며칠 전 Xcode가 업데이트 되어서 그런가,,</p><p><em>“/Users/kang-yunseo/Library/Developer/CoreSimulator/Devices/5938A987–13F8–4F3B-8CB0–9C244E5F1057/data/Library/Caches/com.apple.mobile.installd.staging/temp.epvLca/extracted/pophory-iOS.app/Frameworks/GoogleMobileAds.framework/Info.plist”</em></p><p>보니까 GoogleMobileAds.framework에서 Info.plist를 찾지 못하는 것 같았어요. StackOverFlow에 나오는 해결법을 시도해보았지만 해결되지 않았습니다.</p><p><strong>해결방법: SDK 재설치 및 Clean Build</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KB8Me4KKsaD1dq0wy32s3w.png" /></figure><p>Project &gt; Package Dependency 에서 GoogleMobileAds를 삭제 후 재설치해주었더니 버전이 업데이트 되었습니다.</p><p>그리고 command + shift + K로 Clean Build를 해주었으나 framework만 바뀐 채 Info.plist를 찾지 못하는 오류는 해결되지 않았습니다.</p><p>그래서 해당 오류가 발생하는 모든 framework의 버전을 업데이트 해주었습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAWMynYNLfxQ3be-HDi03g.png" /></figure><p>Project Navigatoin &gt; Package Dependencies &gt; Update Package를 해주면 알아서 업데이트 됩니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*39BvMvfrbq3mbij9uTFnug.png" /></figure><p>정상적으로 빌드 성공~~</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f86f0c0248ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xcode Cloud로 CI/CD 적용하기(1)]]></title>
            <link>https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-1-45b74a7ed167?source=rss-2f530c00cde7------2</link>
            <guid isPermaLink="false">https://medium.com/p/45b74a7ed167</guid>
            <category><![CDATA[xcode-cloud]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[kangYundol]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 10:29:54 GMT</pubDate>
            <atom:updated>2024-03-16T09:05:05.458Z</atom:updated>
            <content:encoded><![CDATA[<p>안녕하세요 토요괴물 윤돌이입니다!</p><p>오늘은 Xcode Cloud로 CI/CD를 적용하는 방법에 대해 작성하려고 합니다.</p><p>그동안 매번 update를 할 때마다 빌드하고 Archive를 수동으로 해주었는데요,, Develop 환경과 Release 환경에 따라 빌드 환경 분리는 되었지만 수동으로 Archive하기 때문에 종종 실수를 하게 되더군요! 그래서 오늘은 Xcode Cloud 기본 설정부터 custom하는 것까지 다뤄보겠습니다.</p><h3>Xcode Cloud</h3><p>Xcode는 Apple 플랫폼을 위한 앱과 프레임워크를 자동으로 build, Test, Archive, Distribute하는데 사용하는 도구 모음입니다.</p><p>프로젝트에 기능이 추가되고 더 많은 플랫폼과 장치를 지원하다보면 프로젝트가 점점 더 복잡해지고 품질을 보장하기 어려워지는 문제가 발생합니다.</p><p>보통 코드 변경 → 프로젝트 build → XCTest로 만든 단위 테스트 → 성능 또는 UI Test 실행 이라는 프로세스를 거친 후 배포를 진행하게 됩니다. 이 과정은 시간도 오래 걸릴 뿐더러 직접 하는 것이기 때문에 오류가 발생할 수 있습니다.</p><p>그래서 Xcode Cloud를 사용한 CI/CD(Continuous Integration and Delivery)를 통해 이런 과정들을 자동화하여 시간을 단축해주고 발생할 수 있는 오류를 보다 쉽게 리포트 받을 수 있도록 하는 것입니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Y1fBgjwYXjH1dbL1vNSmVw.png" /></figure><p>지속적인 통합(CI: Continuous integration)을 사용하면 다양한 시뮬레이터 및 디바이스 환경에서 Build, Test와 기타 Actoins을 동시에 수행할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*kxuqF_5DMFz-e_zCiotGOw.png" /></figure><p>CI가 완료되고 나면 지속적인 배포(CD: Continuous Delivery)를 통해 TestFlight 또는 App Store에 Archive 하거나 TestFlight를 통해 내부 테스터에게 자동으로 새로운 버전의 앱을 전달(CD) 할 수 있습니다. 그 외에 메일을 보내는 등 다양한 기능을 지원하고 있어요.</p><p>새로운 PR이나 기존 PR의 변경 사항을 감지하는 등의 트리거를 설정할 수도 있습니다.</p><h3>왜 Xcode Cloud인가?</h3><p>Xcode Cloud 뿐만 아니라 fastlane과 Github Actions 등으로도 CI/CD를 구축할 수 있습니다.</p><p>그런데 왜 Xcode Cloud를 선택하였는가?!</p><ol><li><strong>GUI 기반의 쉬운 설정</strong></li></ol><p>fastlane과 Github Actions가 직접 script를 작성해서 CI/CD 환경을 구축해야하는 반면 Xcode Cloud는 GUI 환경으로 손쉽게 환경을 구축할 수 있습니다.</p><p>개인적으로 직관적으로 알아보기 쉬운게 가장 좋은 것 같습니다.</p><p><strong>2. First Party</strong></p><p>그리고 Xcode Cloud는 Apple이 만든 CI/CD 툴이기 때문에 안정성 측면에서 Third Party인 fastlane과 Github Actions보다 좋다고 생각했습니다.</p><p>만약,, 정말 만약에 fastlane이나 Github Actions에서 더 이상 iOS 관련 프로젝트의 CI/CD를 지원해주지 않을 수도 있잖아요? 그런 경우에는 또 다른 툴을 찾아 공부하고 적용해야하는데 first party인 Xcode Cloud는 first party이기 때문에 갑작스러운 문제가 발생할 확률이 적다고 생각합니다.</p><p>저는 이런 두 가지 이유로 Xcode Cloud를 선택하게 되었습니다.</p><h3>적용해보자</h3><p>Xcode Cloud를 사용하려면 다음 조건이 선행되어야 합니다.</p><ul><li>Apple Developer Membership을 사용중이어야 합니다.</li><li>Xcode 14.0.1 이상을 사용합니다.</li><li>App Store Connect에서 앱을 만드는데 필요한 권한을 가지고 있어야 합니다.</li><li>일관된 Xcode 프로젝트 또는 워크스페이스를 사용해야합니다.</li></ul><p>준비 되었다면 이제 적용해볼게요~!</p><ol><li><strong>Xcode 실행 후 Integrate &gt; Create Workflow를 선택한다.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEqtiadyeVc9j4uohFEIZg.png" /></figure><p><strong>2. CI/CD를 구축할 프로덕트를 선택합니다.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2c9jv1QFqTNMP_mNKaIQw.png" /></figure><p><strong>3. Workflow에서 Edit Workflow…를 선택해줍니다. </strong>만약 CI/CD 조건을 변경하지 않는다면 Next를 눌러주세요!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDBzT3ygruD0QUznfWgxKg.png" /></figure><p><strong>4. Workflow를 수정한다.</strong></p><p>제가 Xcode Cloud를 적용하려는 프로젝트는 버전 업데이트를 할 때 Develop 브랜치에 머지를 하고 바로 Archive를 해주고 있었는데, 이렇게 하면 버전 기록도 안 남을 뿐더러 Develop 브랜치에서 Debug와 Release 환경을 수동으로 변경해주어야 하기 때문에 앞으로 <strong><em>release/버전</em></strong> 이라는 배포용 브랜치를 만들어 관리하기로 했습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HtxZENF3jS_ZZGHUk96vFg.png" /></figure><p>그래서 release/로 시작하는 브랜치에 변경사항이 생겼을 때 CI/CD가 시작되도록 Custom Branches를 <strong><em>‘branches beginning with “release”’</em></strong>로 설정해주었습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJze7Uq_-Mux_-3YdS6qkA.png" /></figure><p>Actoins는 Test, Build, Archive, Analyze를 추가할 수 있습니다.</p><p>Scheme을 잘 선택해주세요.</p><p>마지막으로 Action이 종료된 후 실행될 Action으로 Post-Actions를 지정해줍니다. TestFlight External Testing, TestFlight Internal Testing, Notify 등을 지정할 수 있습니다.</p><p>저는 Notify를 추가하여 CI/CD 결과가 제 이메일로 전송되도록 설정해주었습니다!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7YGs81Gi0SAVGFDubIXBEQ.png" /></figure><p>그럼 Xcode Cloud 적용 끝~~</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4WsQmU2wXHoRCRLQdoD6Q.png" /></figure><p>잘 설정하고 나면 build 할 브랜치를 설정하고 Start Build를 클릭하면 첫번째 CI/CD를 확인할 수 있습니다.</p><p>App Store Connect &gt; Xcode Cloud에서 실행 경과를 확인할 수 있어요.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1r3p3hbmm-PguA2f6NB3ug.png" /></figure><p>ㅋㅋ 아 왜 안돼..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOCbm1xwNqFW3y_-qQZa7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8uFHiobSEvyQS6vgMxzbQ.png" /></figure><p>원인과 해결방법은<a href="https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-2-f8b5bf092899"> Xcode Cloud로 CI/CD 적용하기(2)</a>에 정리해두었습니다. 참고해주세요!</p><p>[참고]</p><ul><li><a href="https://developer.apple.com/documentation/Xcode/About-Continuous-Integration-and-Delivery-with-Xcode-Cloud">About continuous integration and delivery with Xcode Cloud | Apple Developer Documentation</a></li><li><a href="https://developer.apple.com/documentation/xcode/requirements-for-using-xcode-cloud">Requirements for using Xcode Cloud | Apple Developer Documentation</a></li><li><a href="https://developer.apple.com/documentation/xcode/configuring-your-first-xcode-cloud-workflow">Configuring your first Xcode Cloud workflow | Apple Developer Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45b74a7ed167" width="1" height="1" alt=""><hr><p><a href="https://medium.com/daily-monster/xcode-cloud%EB%A1%9C-ci-cd-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0-1-45b74a7ed167">Xcode Cloud로 CI/CD 적용하기(1)</a> was originally published in <a href="https://medium.com/daily-monster">daily-monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>