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 enumerator = FileManager.default.enumerator(at: projectURL, includingPropertiesForKeys: nil) else { | |
exit(1) | |
} | |
var swiftFileURLs = enumerator.allObjects | |
.compactMap { $0 as? URL } | |
.filter { $0.pathExtension == "swift" } |
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
func +=<T>(lhs: inout T?, rhs: T) where T: SignedNumeric { | |
switch lhs { | |
case .none: | |
break | |
case .some(let value): | |
lhs = .some(value + rhs) | |
} | |
} | |
func -=<T>(lhs: inout T?, rhs: T) where T: SignedNumeric { |
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
# CocoaPods | |
swift_version = "4.0" | |
pod "NextLevel", "~> 0.9.0" | |
# Carthage | |
github "nextlevel/NextLevel" ~> 0.9.0 | |
# Swift PM | |
let package = Package( | |
dependencies: [ |
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
func openAppStore() { | |
let appID = 1227356223 | |
let appURLString: String | |
if #available(iOS 11.0, *) { | |
appURLString = "itms-apps://itunes.apple.com/us/app/itunes-u/id\(appID)?action=write-review" | |
} | |
else { | |
appURLString = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=\(appID)" | |
} | |
UIApplication.shared.openURL(URL(string: appURLString)!) |
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
// swift-tools-version:4.0 | |
import PackageDescription | |
let package = Package( | |
name: "Sasha", | |
dependencies: [ | |
.package(url: "https://github.com/artemnovichkov/carting.git", from: "1.0.0"), | |
], | |
targets: [ |
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
//Inspired by: http://merowing.info/2017/04/using-protocol-compositon-for-dependency-injection/ | |
//Protocols for objects owning services. Interactors in VIPER, for example. | |
protocol HasLogService { | |
var logService: LogService { get } | |
} | |
protocol HasLoginService { | |
var loginService: LoginService { get } | |
} |
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 KeyboardNotificationObserver { | |
typealias Selectors = (show: Selector, hide: Selector) | |
func addKeyboardWillChangeObservers(with selectors: Selectors) | |
func removeKeyboardWillChangeObservers() | |
func addKeyboardDidChangeObservers(with selectors: Selectors) | |
func removeKeyboardDidChangeObservers() | |
} |
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
disabled_rules: | |
- trailing_whitespace | |
excluded: | |
- Carthage/ | |
force_try: warning | |
force_cast: warning | |
line_length: 180 | |
colon: | |
apply_to_dictionaries: false |
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 AppKit | |
extension NSViewController { | |
static func load<T>() -> T where T: NSViewController { | |
return T(nibName: T.className(), bundle: nil)! | |
} | |
} | |
//Usage: | |
//let viewController: LoginViewController = .load() |