Skip to content

Instantly share code, notes, and snippets.

View ivangodfather's full-sized avatar
🍂

Ivan Ruiz ivangodfather

🍂
View GitHub Profile
struct Colors {
static let colorOne = UIColor(red:0.87, green:0.85, blue:0.82, alpha:1)
}
let mapColor = ["colorOne": Colors.colorOne]
This is what i have...
@IBInspectable var colorString: String = "" {
didSet {
backgroundColor = colorDict[colorString]
}
}
let colorDict = [
"colorOne": UIColor(red:0.87, green:0.85, blue:0.82, alpha:1),
if iOS8 {
let userNotificationTypes: UIUserNotificationType = (UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound)
let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
let userNotificationTypes: UIRemoteNotificationType = (UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound)
application.registerForRemoteNotificationTypes(userNotificationTypes)
}
protocol MyProtocol {
func method() -> String
func hey() -> String
var commonOfMyClass: CommonMyClass { get } // i need this here
}
protocol SharedLogic {
func hey() -> String
}
protocol MyProtocol {
func method() -> String
func hey() -> String
var commonOfMyClass: CommonMyClass { get }
}
protocol SharedLogic {
func hey() -> String
}
protocol MyProtocol {
func method() -> String
func hey() -> String
}
protocol SharedLogic {
func hey() -> String
}
class CommonMyClass: SharedLogic {
protocol MyProtocol {
func method() -> String
var commonOfMyClass: CommonMyClass! { get }
}
class CommonMyClass {
func commontPrint() -> String {
return "Hey im common"
}
}
class SharedMethods {
func sharedMethod() {
println("Shared :-)")
}
}
protocol MyProtocol {
func method() -> String
}
extension MainMenuVC: UITableViewDataSource {
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell") as? MenuEntryView
if cell == nil {
cell = NSBundle.mainBundle().loadNibNamed("XibName", owner: self, options: nil).first as SubclassUITableViewCell
println("new one")
} else {
println("dequeued!")
}
func loadViewFromNib() -> UIView {
//Option 1
let bundle = NSBundle.mainBundle()
let nib = UINib(nibName: nibName, bundle: bundle)
return nib.instantiateWithOwner(self, options: nil)[0] as UIView
//Option 2
return NSBundle.mainBundle().loadNibNamed(nibName, owner: self, options: nil).first! as UIView
}