This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { | |
| let products: [SKProduct] = response.products | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func fetchProducts() { | |
| let identifiers: Set<String> = ["com.app.premium.monthly","com.app.premium.annual"] | |
| let productsRequest = SKProductsRequest(productIdentifiers: identifiers) | |
| productsRequest.delegate = self | |
| productsRequest.start() | |
| } | |
| //SKProductsRequestDelegate | |
| func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { | |
| let products: [SKProduct] = response.products |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| variables: | |
| ITUNESCONNECT_USER: "user@user.com" | |
| ITUNESCONNECT_PASS: "" | |
| stages: | |
| - archive | |
| archive_project: | |
| stage: archive | |
| script: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stages: | |
| - build | |
| build_project: | |
| stage: build | |
| script: | |
| - xcodebuild test -workspace <Project_Name>.xcworkspace -scheme <Schema_Name> -destination 'platform=iOS Simulator,name=iPhone 8' | |
| tags: | |
| - ios_12-2 | |
| - xcode_10-2-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Array where Element: Decodable { | |
| enum ArrayDecodeError: String, Error { | |
| case nilData | |
| } | |
| static func decode(with data: Data?) throws -> [Element] { | |
| guard let data = data else { throw ArrayDecodeError.nilData } | |
| let arr = try JSONDecoder().decode([Failable<Element>].self, from: data) | |
| let elements = arr.compactMap{ $0.obj } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fileprivate struct Failable<T: Decodable>: Decodable { | |
| let obj:T? | |
| init(from decoder: Decoder) throws { | |
| let container = try decoder.singleValueContainer() | |
| self.obj = try? container.decode(T.self) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public func encode(to encoder: Encoder) throws { | |
| var baseContainer = encoder.container(keyedBy: BaseContainer.self) | |
| try baseContainer.encode(self.address, forKey: .address) | |
| var dataContainer = baseContainer.nestedContainer(keyedBy: DataContainer.self, forKey: .data) | |
| try dataContainer.encode(self.name, forKey: .name) | |
| try dataContainer.encode(self.age, forKey: .age) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Person { | |
| public init(from decoder: Decoder) throws { | |
| let baseContainer = try decoder.container(keyedBy: BaseContainer.self) | |
| self.address = try baseContainer.decode(String.self, forKey: .address) | |
| let dataContainer = try baseContainer.nestedContainer(keyedBy: DataContainer.self, forKey: .data) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Person { | |
| private enum BaseContainer: String, CodingKey { | |
| case address | |
| case data | |
| case otherData = "Other_Data" | |
| } | |
| private enum DataContainer: String, CodingKey { | |
| case name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Person: Codable { | |
| var id: Int | |
| var name: String | |
| var age: Int | |
| var address: String | |
| } |