Skip to content

Instantly share code, notes, and snippets.

View shabib87's full-sized avatar

Shabib Hossain shabib87

View GitHub Profile
@shabib87
shabib87 / UIFont+DahDit
Last active August 1, 2016 06:09 — forked from erkie/UIFont+DahDit
UILabel get CGRect for substring of text
//
// UIFont+DahDit.m
// DahDit
//
// Created by Erik Andersson on 2011-07-28.
// Copyright 2011 Åva gymnasium. All rights reserved.
//
#import "UIFont+DahDit.h"
class SmartBoat: SmartVehicle, RoadDrivable, WaterDrivable {
func driveOnRoad() {
print("Vroom!")
}
func driveOnWater() {
print("I can run over water, because I can! B-)")
}
}
class SuperSmartCar: SmartCar {
func driveOnWater() {
print("I can run over water, because I can! B-)")
}
}
protocol Flyable {
func flyOnAir()
}
class SmartFlyingCar: SmartCar, Flyable {
func flyOnAir() {
print("Wohoo! I am flying high!")
}
}
protocol RoadDrivable {
func driveOnRoad()
}
protocol WaterDrivable {
func driveOnWater()
}
protocol Flyable {
func flyOnAir()
class SmartCar {
func driveOnRoad() {
print("Vroom!")
}
func talk() {
print("Hi! I am the smart talking car!")
}
}
@implementation Singleton
+ (instancetype)sharedInstance {
static Singleton *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[Singleton alloc] init];
});
return sharedInstance;
class Singleton {
static let sharedInstance = Singleton()
private init() {
// do stuff
}
}
class User {
var name = ""
var age = 0
}
class EditUserInfoController {
var user: User
init (user: User) {
self.user = user
enum OrderSize {
case small
case medium
case large
}
enum SpiceRange {
case spicy
case hot
case extraHot