This file contains 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
enum RequestError: Error { | |
case apiError(reason: String) | |
} | |
class AsyncJokeGenerator: AsyncSequence { | |
__consuming func makeAsyncIterator() -> AsyncIterator { | |
return AsyncIterator(numberOfJokes: numberOfJokes) | |
} | |
typealias Element = String |
This file contains 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
import SwiftUI | |
import UIKit | |
import Foundation | |
import Combine | |
enum RequestError: Error { | |
case apiError(reason: String) | |
} | |
class ResultController: ObservableObject { |
This file contains 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
typealias JSON = [String: Any] | |
/// Helper for getting value from nested json dictionary | |
extension JSON { | |
/// Get the value of the given keypath. | |
/// - Parameter Path: The keypath separated by "." | |
/// - Returns: The value of the specified keypath. Return `nil` if the value is not found. | |
public subscript<T>(path path: String) -> T? { | |
get { | |
var dic: JSON? = self | |
let keyPaths = path.split(separator: ".").map { String($0) } |
This file contains 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
import PlaygroundSupport | |
import SwiftUI | |
enum MoveAction: String { | |
case left | |
case right | |
case up | |
case down | |
var systemImageName: String { | |
return "arrow.\(self.rawValue)" |
This file contains 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
#if PROD | |
print(“We brew beer in the Production”) | |
#elseif STG | |
print(“We brew beer in the Staging”) | |
#endif |
This file contains 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
exportOptions: [ | |
"signingStyle": "manual", | |
"provisioningProfiles": [config.appIdentifier: config.provisioningProfile] ] |
This file contains 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
buildApp( | |
workspace: ProjectSetting.workspace, | |
scheme: ProjectSetting.scheme, | |
clean: true, | |
outputDirectory: "./", | |
outputName: "\(ProjectSetting.productName).ipa", | |
configuration: config.buildConfiguration, | |
silent: true, | |
exportMethod: config.exportMethod, | |
exportOptions: [ |
This file contains 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
updateProjectProvisioning( | |
xcodeproj: ProjectSetting.project, | |
profile: "\(ProjectSetting.codeSigningPath)/\(config.provisioningProfile).mobileprovision", | |
targetFilter: "^\(ProjectSetting.target)$", | |
buildConfiguration: config.buildConfiguration | |
) |
This file contains 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
enum ProjectSetting { | |
static let codeSigningPath = environmentVariable(get: "CODESIGNING_PATH") | |
static let certificatePassword = environmentVariable(get: "CERTIFICATE_PASSWORD") | |
} |
This file contains 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
importCertificate( | |
keychainName: environmentVariable(get: "KEYCHAIN_NAME"), | |
keychainPassword: environmentVariable(get: "KEYCHAIN_PASSWORD"), | |
certificatePath: "\(ProjectSetting.codeSigningPath)/\(config.certificate).p12", | |
certificatePassword: ProjectSetting.certificatePassword | |
) |
NewerOlder