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 Foundation | |
| /// An abstraction if `UIView` styling. | |
| struct UIViewStyle<T: UIResponder> { | |
| /// The styling function that takes a `UIView` instance | |
| /// and performs side-effects on it. | |
| public let styling: (T) -> Void |
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
| profileService.createProfile() | |
| .then{ profile -> Void in | |
| // do something with profile | |
| }. catch { error in | |
| // handle error | |
| } |
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
| func createProfile(with details: [String:Any]) -> Promise<Profile> { | |
| return firstly | |
| { | |
| // return a promise to signup | |
| auth.signup(with: details) | |
| }.then { _ in | |
| // I don’t need the value I only care that It passed. | |
| auth.signIn(email: email, password: password) | |
| }.then { | |
| auth.user(with: details) |
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
| func createProfile(completionHandler: @escaping (Any?, Error?) -> Void) { | |
| let params = self.params() | |
| // sign up | |
| auth.signup(with: params) { error in | |
| guard error == nil else { completionHandler(nil, error); return } | |
| // log in | |
| self.auth.signIn(email: email, password: password, completion: { (error) in | |
| guard error == nil else { completionHandler(nil, error); return } | |
| // get users profile | |
| self.auth.user(with: params, completion: { (error, individual) in |
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
| Step 1: Create Certificate .pem from Certificate .p12 | |
| Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12 | |
| Step 2: Create Key .pem from Key .p12 | |
| Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12 | |
| Step 3: Optional (If you want to remove pass phrase asked in second step) | |
| Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem | |
| Step 4: Now we have to merge the Key .pem and Certificate .pem to get Development .pem needed for Push Notifications in Development Phase of App |
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
| override func viewDidLayoutSubviews() { | |
| super.viewDidLayoutSubviews() | |
| // get pageControl and scroll view from view's subviews | |
| let pageControl = view.subviews.filter{ $0 is UIPageControl }.first! as! UIPageControl | |
| let scrollView = view.subviews.filter{ $0 is UIScrollView }.first! as! UIScrollView | |
| // remove all constraint from view that are tied to pagecontrol | |
| let const = view.constraints.filter { $0.firstItem as? NSObject == pageControl || $0.secondItem as? NSObject == pageControl } | |
| view.removeConstraints(const) |