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
@propertyWrapper | |
struct Logging<T> { | |
var value: T | |
init(wrappedValue value: T) { | |
self.value = value | |
} | |
var wrappedValue: T { |
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
on: pull_request | |
name: Test | |
jobs: | |
test: | |
name: Test | |
runs-on: macOS-latest | |
strategy: | |
matrix: | |
destination: ['platform=iOS Simulator,OS=12.2,name=iPhone X', 'platform=tvOS Simulator,OS=12.2,name=Apple TV 4K'] | |
steps: |
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
language: swift | |
osx_image: xcode10.2 | |
env: | |
matrix: | |
- DESTINATION="platform=iOS Simulator,OS=12.2,name=iPhone X" | |
- DESTINATION="platform=tvOS Simulator,OS=12.2,name=Apple TV 4K" | |
before_script: cd Texstyle |
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
// Create an interator class | |
class ElementIterator<T>: IteratorProtocol { | |
typealias Element = T | |
let element: T | |
init(element: T) { | |
self.element = element | |
} |
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 Foundation | |
extension URL { | |
/// Returns an url for App Store app. | |
/// | |
/// Example: [itms-apps://itunes.apple.com/app/id1434568484?action=write-review]() | |
/// | |
/// - Parameters: | |
/// - id: The id of the app. |
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
struct User { | |
let username: String | |
} | |
final class user Service { | |
static let shared = Service() | |
var user: User? | |
} |
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
#!/usr/bin/env xcrun --sdk macosx swift | |
import Foundation | |
enum Configuration: String { | |
case debug = "Debug" | |
case release = "Release" | |
} | |
// Get Info.plist path |
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 Foundation | |
// Get project URL | |
guard let projectDirRawValue = getenv("PROJECT_DIR"), | |
let projectDirectoryPath = String(utf8String: projectDirRawValue) else { | |
exit(1) | |
} | |
let projectURL = URL(fileURLWithPath: projectDirectoryPath) | |
// Get Info.plist path | |
guard let productSettingsPathRawValue = getenv("PRODUCT_SETTINGS_PATH"), |
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
guard let productSettings = NSDictionary(contentsOfFile: productSettingsPath) else { | |
exit(1) | |
} | |
for key in keys { | |
guard let value = productSettings[key] as? String else { | |
// Missing key | |
exit(1) | |
} | |
if value.isEmpty { | |
// Empty description |
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
var keys: [String] = [] | |
for url in swiftFileURLs { | |
let contents = try String(contentsOf: url, encoding: .utf8) | |
for (pattern, key) in patterns { | |
if contents.contains(pattern) { | |
keys.append(key) | |
} | |
} | |
} |