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 EmbeddableCustomView: UIView, HasNib { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
// Render xib view from code. | |
commonInit() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) |
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
// MARK: Support for instantiation from NIB | |
public extension HasNib where Self: UIView { | |
static var nib: UINib { | |
return UINib(nibName: String(describing: self), bundle: Bundle(for: self)) | |
} | |
// Adds content loaded from the nib to the end of the | |
// receiver's list of subviews and adds constraints automatically. | |
func loadNibContent() { |
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 HasNib: class { | |
static var nib: UINib { get } | |
} | |
public extension HasNib { | |
static var nib: UINib { | |
return UINib(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
import UIKit | |
class PushedViewController: UIViewController { | |
var currentWeather: Observable<Double>! | |
private let disposeBag = MyDisposeBag() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
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 Moya | |
class ViewController: UIViewController { | |
private let instaFoodProvider = MoyaProvider<InstaFoodService>() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
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 | |
public typealias RequestResponse = (_ statusCode:Int, _ data:AnyObject?) -> Void | |
struct RequestManager { | |
static func makeHTTPSRequest( | |
_ token: String?, | |
postBody: AnyObject? = nil, | |
methodString:String, |
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
struct Person { | |
var name:String | |
} | |
let leo = Person(name: "Leo") | |
let nicole = Person(name: "Nicole") | |
let leonardoButCalledLeo = Person(name: "Leo") | |
let ashton = Person(name: "Ashton") |
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 Cocoa | |
// MARK: Goal- Find the number of times any item appears in array | |
var tayLyrics = "Nice to meet you, where you been? I could show you incredible things Magic, madness, heaven, sin Saw you there and I thought Oh my God, look at that face You look like my next mistake Love’s a game, want to play? New money, suit & tie" | |
var stringArray = tayLyrics.componentsSeparatedByString(" ") | |
var intArray = [1,4,5,2,6,6,6] |