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
typealias ObservableType = Publisher | |
typealias ObserverType = Subscriber | |
typealias Observable<Element> = AnyPublisher<Element, Error> | |
typealias Observer<Element, Failure: Error> = AnySubscriber<Element, Failure> | |
extension ObservableType { | |
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
// | |
// CleanJSON.swift | |
// CleanJSON | |
// | |
// Created by Pircate on 2018/5/3. | |
// Copyright © 2018年 Pircate. All rights reserved. | |
// | |
import Foundation |
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 SnapKit | |
public struct ConstraintViewControllerDSL { | |
fileprivate let base: UIViewController | |
init(_ base: UIViewController) { | |
self.base = base | |
} | |
} |
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 "NSNumber+Countdown.h" | |
@implementation NSNumber (Countdown) | |
- (dispatch_source_t)countdownWithInterval:(NSTimeInterval)interval | |
executing:(void (^)(NSTimeInterval))executing | |
completion:(void (^)(void))completion { | |
__block NSTimeInterval timeout = self.doubleValue; | |
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0)); | |
dispatch_source_set_timer(timer, dispatch_walltime(NULL, 0), interval * NSEC_PER_SEC, 0 * NSEC_PER_SEC); |
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
extension UITextInput where Self: UIView { | |
func avoidCoveredByKeyboard( | |
from view: UIView, | |
_ offset: CGFloat = 0 | |
) { | |
NotificationCenter.default.addObserver( | |
forName: UIApplication.keyboardWillShowNotification, | |
object: nil, | |
queue: .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
public class ReferenceBox<Value: Codable>: Codable { | |
public var value: Value | |
required public init(from decoder: Decoder) throws { | |
let container = try decoder.singleValueContainer() | |
self.value = try container.decode(Value.self) | |
} | |
public func encode(to encoder: Encoder) throws { |
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
// | |
// MovableCollectionView.swift | |
// MovableCollectionView | |
// | |
// Created by Pircate on 2018/9/6. | |
// Copyright © 2018年 Pircate. All rights reserved. | |
// | |
import UIKit |