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 UIKit | |
protocol GradientEffect { | |
var gradientEffectEnabled: Bool { get set } | |
} | |
extension GradientEffect where Self: UIView { | |
func setGradientView() { |
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 Person: CustomDebugStringConvertible { | |
var name: String | |
var age: Int | |
var debugDescription: String { | |
return "\(name)(\(age))" | |
} | |
} | |
let persons = [ |
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 | |
public struct Clip: Codable, Equatable { | |
public var id: Int | |
public var category: ClipCategory | |
public var title: String | |
public var userTitle: String | |
public var imageURLString: String | |
public var source: 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 Foundation | |
extension TimeInterval { | |
var seconds: Int { | |
return Int(self.rounded()) | |
} | |
var milliseconds: Int { | |
return Int(self * 1_000) |
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 UIKit | |
/// Protocol that must be concatenated for the convenient use of`ForceTouchGestureRecognizer` | |
protocol ForceTouchGestureConvertible: class { | |
var forceTouchGestureRecognizer: UIGestureRecognizer? { get set } | |
} | |
extension ForceTouchGestureConvertible where Self: UIView { | |
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 | |
exntension Date { | |
func toString(format: String) -> String { | |
let formatter = DateFormatter() | |
formatter.calendar = Calendar(identifier: .gregorian) | |
formatter.dateFormat = format | |
return formatter.string(from: self) | |
} | |
} |
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 ServiceProviderType { | |
var clipService: ClipServiceType { get } | |
} | |
class ServiceProvider: ServiceProviderType { | |
lazy var clipService: ClipServiceType = ClipService(provider: self, clipAPI: ClipAPI()) | |
} |
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
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
var launcher: Laucher? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
let window = UIWindow(frame: UIScreen.main.bounds) | |
self.window = window | |
launcher = AppLauncher(application: application, launchItem: AppLaunchItem(window: window)) |
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 Storyboard { | |
case main | |
var filename: String { | |
switch self { | |
case .main: return "Main" | |
} | |
} | |
} |
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 RxSwift | |
import UIKit | |
extension UIAlertController { | |
struct AlertAction { | |
var title: String? | |
var style: UIAlertAction.Style | |
static func action(title: String?, style: UIAlertAction.Style = .default) -> AlertAction { |
OlderNewer