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
class ISO8601DateFormatter { | |
private static var cachedCalendar: Calendar = { | |
var calendar = Calendar(identifier: .gregorian) | |
calendar.timeZone = TimeZone.gmt | |
return calendar | |
}() | |
static func format(_ date: Date) -> String { | |
let components = cachedCalendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: date) |
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 | |
enum Either<A,B> { | |
case left(A) | |
case right(B) | |
} | |
// Works only using Swift 4.1 | |
extension Either: Codable where A: Codable, B: Codable { | |
enum CodingKeys: CodingKey { |
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 RxSwift | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
extension ObservableType where E: Sequence { | |
typealias T = E.Iterator.Element | |
/// Create an observable which is an Array of the projected values |
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
post_install do |installer| | |
installer.project.targets.each do |target| | |
target.build_configurations.each do |config| | |
if config.name == 'BREnterprise' | |
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution: The Carter Group LLC' | |
config.build_settings['PROVISIONING_PROFILE'] = '${BR_ENTERPRISE_PROVISIONING_PROFILE}' | |
end | |
end | |
end |
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 Dispatch | |
import PromiseKit | |
/// A wrapper for a function that creates a Promise. | |
public class PromiseOperation<T> { | |
private let makePromise: () -> Promise<T> | |
public init(makePromise: @escaping () -> Promise<T>) { | |
self.makePromise = makePromise | |
} |
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
// | |
// RealmSwift+Codable.swift | |
// | |
// Created by Anson Yao on 7/25/18. | |
// | |
//Adding this file can make your classes inherited from Realm Object comfirm to Codable easily | |
//Inspired by @mishagray https://gist.github.com/mishagray/3ee82a3a82f357bfbf8ff3b3d9eca5cd |
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 [ $CONFIGURATION == Release ]; then | |
echo "Bumping build number..." | |
plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
# increment the build number (ie 115 to 116) | |
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
if [[ "${buildnum}" == "" ]]; then | |
echo "No build number in $plist" | |
exit 2 | |
fi |
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
// | |
// Device.swift | |
// imHome | |
// | |
// Created by Kevin Xu on 2/9/15. Updated on 6/20/15. | |
// Copyright (c) 2015 Alpha Labs, Inc. All rights reserved. | |
// | |
import Foundation |