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 Foundation | |
| import UIKit | |
| protocol SelfAware: class { | |
| static func awake() | |
| } | |
| class ModuleManagerBase { | |
| static func registerModules() { | |
| //let startTime = NSDate.timeIntervalSinceReferenceDate |
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 RawEnum { | |
| var anyRawValue: Any { get } | |
| } | |
| public extension RawEnum where Self: RawRepresentable { | |
| public var anyRawValue: Any { | |
| get { | |
| let mirror = Mirror(reflecting: self) | |
| if mirror.displayStyle != .enum { | |
| print("WARNING: You can only extend an enum with the Enum protocol") |
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
| // | |
| // WebViewExampleViewController.swift | |
| // | |
| // Created by Felix Mau on 06.01.18. | |
| // Copyright © 2018 Felix Mau. All rights reserved. | |
| // | |
| import UIKit | |
| import WebKit |
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 UIView { | |
| func setAnchorPoint(_ point: CGPoint) { | |
| var newPoint = CGPoint(x: bounds.size.width * point.x, y: bounds.size.height * point.y) | |
| var oldPoint = CGPoint(x: bounds.size.width * layer.anchorPoint.x, y: bounds.size.height * layer.anchorPoint.y) | |
| newPoint = newPoint.applying(transform) | |
| oldPoint = oldPoint.applying(transform) | |
| var position = layer.position |
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 UIStackView { | |
| func reverseSubviewsZIndex(setNeedsLayout: Bool = true) { | |
| let stackedViews = self.arrangedSubviews | |
| stackedViews.forEach { | |
| self.removeArrangedSubview($0) | |
| $0.removeFromSuperview() | |
| } |
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 MyTableViewController: UITableViewController { | |
| override func viewWillAppear(_ animated: Bool) { | |
| super.viewWillAppear(animated) | |
| bottomButton.size = CGSize(width: self.view.width, height: 50) | |
| bottomButton.translatesAutoresizingMaskIntoConstraints = false | |
| bottomButton.addTarget(self, action: #selector(bottomButtonClick), for: .touchUpInside) | |
| self.navigationController?.setToolbarHidden(false, animated: animated) |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>items</key> | |
| <array> | |
| <dict> | |
| <key>assets</key> | |
| <array> | |
| <dict> |
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
| extentsion String { | |
| func SHA256() -> String { | |
| if let stringData = self.data(using: .utf8) { | |
| return self.hexStringFromData(input: digest(input: stringData as NSData)) | |
| } else { | |
| return 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 Dictionary { | |
| func urlQueryEncode() -> String { | |
| return self | |
| .map({ "\($0)=\($1)" }) | |
| .joined(separator: "&") | |
| .addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | |
| } | |
| func queryParameters() -> String { | |
| let parameterArray = self.map { (key, value) -> String in |
NewerOlder