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 | |
/// Represents a single `NSLayoutConstraint` | |
enum LayoutAnchor { | |
case constant(attribute: NSLayoutConstraint.Attribute, | |
relation: NSLayoutConstraint.Relation, | |
constant: CGFloat) | |
case relative(attribute: NSLayoutConstraint.Attribute, | |
relation: NSLayoutConstraint.Relation, |
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 | |
final class CustomVC: UIViewController { | |
private lazy var contentView: CustomView = CustomView() | |
// MARK: - Life cycle | |
deinit { | |
NotificationCenter.default.removeObserver(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
// SnapKit(Masonry) 1 | |
// https://github.com/SnapKit/Masonry | |
[self. addSubview: scrollView]; | |
[scrollView mas_makeConstraints:^(MASConstraintMaker *make) { | |
make.edges.equalTo(safeAreaLayoutGuide); | |
}]; | |
[scrollView addSubview: contentView]; | |
[contentView mas_makeConstraints:^(MASConstraintMaker *make) { |
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
// | |
// AsynchronousBlockOperation.swift | |
// | |
// Created by Jose Canepa on 12/13/17. | |
// Copyright © 2017 Jose Canepa. All rights reserved. | |
// | |
import Foundation | |
/// Block based version of the AsynchronousOperation |
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 showMessageResetApp(){ | |
let exitAppAlert = UIAlertController(title: "Restart is needed", | |
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.", | |
preferredStyle: .alert) | |
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) { | |
(alert) -> Void in | |
// home button pressed programmatically - to thorw app to background | |
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil) | |
// terminaing app in background |
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
// | |
// UserDefaults+CLLocation.swift | |
// | |
// | |
// Created by John Spiropoulos on 28/09/16. | |
// Copyright © 2016 John Spiropoulos. All rights reserved. | |
// | |
/* | |
Swift 3 Helper extension: |