This file contains hidden or 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 UserType { | |
| associatedtype Input: Content | |
| associatedtype Output: Content | |
| static func signUp(input: Input, on: Request) throws -> Future<AuthResult<Output>> | |
| static func signIn(on: Request) throws -> Future<AuthResult<Output>> | |
| } | |
| struct AuthResult<T: Content>: Content { // where T: Student.Public or T: Organization.Public | |
| let accessToken: AccessToken |
This file contains hidden or 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 | |
| class GradientView: UIView { | |
| override class var layerClass: AnyClass { | |
| return CAGradientLayer.self | |
| } | |
| private var gradientLayer: CAGradientLayer? { | |
| return layer as? CAGradientLayer |
This file contains hidden or 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 ActivityIndicator: SharedSequenceConvertibleType { | |
| public typealias Element = Bool | |
| public typealias SharingStrategy = DriverSharingStrategy | |
| private let _lock = NSRecursiveLock() | |
| private let _variable = Variable(false) | |
| private let _loading: SharedSequence<SharingStrategy, Bool> | |
| public init() { | |
| _loading = _variable.asDriver() |
This file contains hidden or 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 | |
| import RxSwift | |
| import RxCocoa | |
| import RxFeedback | |
| class ViewController: UIViewController { | |
| @IBOutlet weak var counterLabel: UILabel! | |
| @IBOutlet weak var incrementButton: UIButton! |
This file contains hidden or 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 NibLoadable: class { | |
| static var nib: UINib { get } | |
| } | |
| extension NibLoadable { | |
| static var nib: UINib { | |
| return UINib.init(nibName: String(describing: self), bundle: Bundle(for: self)) | |
| } | |
| } |
This file contains hidden or 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 String { | |
| func boundingSize(size: CGSize, attributes: [NSAttributedString.Key: Any]?) -> CGSize { | |
| let attributedString = NSAttributedString(string: self, attributes: attributes) | |
| let options: NSStringDrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading] | |
| let boundedRect = attributedString.boundingRect(with: size, options: options, context: nil) | |
| let width = ceil(boundedRect.width) | |
| let height = ceil(boundedRect.height) | |
| return CGSize(width: width, height: height) |
This file contains hidden or 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 | |
| class AnotherViewController: UIViewController { | |
| var initialTouchPoint = CGPoint(x: 0, y: 0) | |
| @IBAction func close() { | |
| dismiss(animated: true, completion: nil) | |
| } | |
This file contains hidden or 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 SubChild { | |
| func doSubChildMethod() | |
| } | |
| class SubChildImpl: SubChild { | |
| func doSubChildMethod() { | |
| print("doSubChildMethod") | |
| } | |
| } |
This file contains hidden or 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 AnotherViewController: UITableViewController { | |
| // 50, 100, 150, 200 слов | |
| let textData = [ | |
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia, ut?", | |
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non, ex, tempore! Voluptate cumque tempora expedita quos sunt ad fuga sequi quo nostrum tempore beatae illo modi eum repudiandae, laborum possimus aspernatur. Repudiandae animi similique atque at ut quas, porro eius cum doloremque, quae laboriosam reprehenderit odit, provident modi magni. Veniam.", | |
| "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Provident ipsum ut fuga officiis enim quisquam iure, sapiente praesentium quam quia deserunt minima pariatur, quod rem. Velit eaque dolor, sint aut culpa. Nam dolor odio porro rerum assumenda veniam, eius nulla maiores at voluptates rem esse qui sapiente incidunt corporis provident commodi excepturi iusto eligendi non optio reiciendis. Totam eum nihil tempore odio aliquid placeat. Explicabo vitae necessitatibus mag |
This file contains hidden or 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 protocol OptionalType { | |
| associatedtype Wrapped | |
| var value: Wrapped? { get } | |
| } | |
| extension Optional: OptionalType { | |
| public var value: Wrapped? { | |
| return self | |
| } | |
NewerOlder