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
enum SegueIdentifier: String { | |
case SegueToRedViewIdentifier = "SegueToRedViewIdentifier" | |
case SegueToGreenViewIdentifier = "SegueToGreenViewIdentifier" | |
case SegueToBlueViewIdentifier = "SegueToBlueViewIdentifier" | |
init?(optionalRawValue: String?) { | |
if let value = optionalRawValue { | |
switch value { | |
case "SegueToRedViewIdentifier": self = .SegueToRedViewIdentifier | |
case "SegueToGreenViewIdentifier": self = .SegueToGreenViewIdentifier |
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
enum SegueIdentifier: String { | |
case SegueToRedViewIdentifier = "SegueToRedViewIdentifier" | |
case SegueToGreenViewIdentifier = "SegueToGreenViewIdentifier" | |
case SegueToBlueViewIdentifier = "SegueToBlueViewIdentifier" | |
} | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if let segueIdentifier = segue.identifier { | |
if let segueIdentifierValue = SegueIdentifier(rawValue: segueIdentifier) { |
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
enum SegueIdentifier: String { | |
case SegueToRedViewIdentifier = "SegueToRedViewIdentifier" | |
case SegueToGreenViewIdentifier = "SegueToGreenViewIdentifier" | |
case SegueToBlueViewIdentifier = "SegueToBlueViewIdentifier" | |
} | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if let segueIdentifier = SegueIdentifier( |
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
enum SegueIdentifier: String { | |
case ToRed = "Red" | |
case ToGreen = "Green" | |
case ToBlue = "Blue" | |
init?(_ rawValue: String?) { | |
/// check if rawValue is nil | |
if rawValue == nil { | |
return nil | |
} |
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
enum SegueIdentifier: String { | |
case ToRed = "Red" | |
case ToGreen = "Green" | |
case ToBlue = "Blue" | |
init?(_ rawValue: String?) { | |
let out = SegueIdentifier(rawValue: rawValue ?? "") | |
if rawValue != nil && out != nil { | |
self = out! | |
} else { |
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
class ViewController: UIViewController { | |
@IBOutlet weak var textField: UITextField! | |
@IBOutlet weak var actionButton: UIButton! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.actionButton.enabled = false | |
} | |
@IBAction func onActionPressed(sender: AnyObject) { |
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
class ViewController: UIViewController { | |
/// outlet for the control may be here if used | |
} |
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
override func awakeAfterUsingCoder(aDecoder: NSCoder) -> AnyObject? { | |
if self.subviews.count == 0 { | |
let nib = UINib(nibName: "MessageControl", bundle: nil) | |
let view = nib.instantiateWithOwner(nil, options: nil).first! as MessageControl | |
view.setTranslatesAutoresizingMaskIntoConstraints(false) | |
return view | |
} | |
return 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
class MessageControl: UIView { | |
@IBOutlet weak var textField: UITextField! | |
@IBOutlet weak var actionButton: UIButton! | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
self.actionButton.enabled = false | |
} | |
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
// | |
// main.cpp | |
// ctci-3-3 | |
// | |
// Created by Tomasz Szulc on 14/07/15. | |
// Copyright (c) 2015 Tomasz Szulc. All rights reserved. | |
// | |
#include <iostream> |
OlderNewer