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 Combine | |
private protocol LockImplementation { | |
mutating func lock() | |
mutating func `try`() -> Bool | |
mutating func unlock() | |
} | |
private struct UnfairLock: LockImplementation { | |
private var unfairLock = os_unfair_lock_s() |
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 | |
import MessageUI | |
struct EmailParameters { | |
/// Guaranteed to be non-empty | |
let toEmails: [String] | |
let ccEmails: [String] | |
let bccEmails: [String] | |
let subject: String? | |
let body: 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
require 'fileutils' | |
require 'tmpdir' | |
require 'English' | |
prov_profiles_install_path = '~/Library/MobileDevice/Provisioning Profiles' | |
prov_profiles_archive_url = ENV['ADDITIONAL_PROVISIONING_PROFILES_ARCHIVE_URL'] | |
temporary_dir = File.join(Dir.tmpdir, "additional_prov_profiles") |
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
# Install Pods and use `--repo-update` if needed (might need to add sudo for the gem command below) | |
set -e | |
if [ -f "./Podfile" ] && [ ! -d "./Pods" ]; then | |
echo "Podfile found and Pods are not checked-in to git; installing Pods" | |
if [ -f "./Podfile.lock" ]; then | |
current_version=`pod --version | xargs echo -n` | |
podfile_version=`cat Podfile.lock | grep -E 'COCOAPODS: \d(\.\d)*' | sed -E 's/COCOAPODS: (.*)/\1/' | xargs echo -n` | |
if [ "$current_version" != podfile_version ]; then | |
echo "Cocoapods version $current_version doesn't match the Podfile.lock version $podfile_version, installing Podfile.lock version" |
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
// swiftlint:disable all | |
// Copyright 2018 Stéphane Copin | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
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
// The goal of this file is to allow easy uncurrying of member methods. | |
// For example, if you have: | |
// final class MyClass { | |
// func doSomething(_ arg1: Bool, _ arg2: String) -> Bool { | |
// // Something... | |
// return true | |
// } | |
// } | |
// And you want to be able to call `doSomething` as a regular function, you'd have to do `MyClass.doSomething(myClassInstance)(arg1, arg2) | |
// With this, you can do `uncurry(MyClass.doSomething)(myClassInstance, arg1, arg2)` which can be helpful and desirable. |
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 Version { | |
let major: UInt | |
let minor: UInt | |
let patch: UInt? | |
init(major: UInt, minor: UInt = 0, patch: UInt? = nil) { | |
self.major = major | |
self.minor = minor | |
self.patch = patch | |
} |
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
protocol EnumDecodable: RawRepresentable, Decodable { | |
static func defaultDecoderValue() throws -> Self | |
} | |
enum EnumDecodableError: Swift.Error { | |
case noValue | |
} | |
extension EnumDecodable { |
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
private class WeakTarget: NSObject { | |
private(set) weak var target: AnyObject? | |
let selector: Selector | |
static let triggerSelector = #selector(WeakTarget.timerDidTrigger(parameter:)) | |
init(_ target: AnyObject, selector: Selector) { | |
self.target = target | |
self.selector = selector |
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
The MIT License (MIT) | |
Copyright (c) 2016 Fueled | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
NewerOlder