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
#import <objc/runtime.h> | |
@implementation NSObject (SimpleObjectMapping) | |
+ (instancetype) objectFromDictionary:(NSDictionary *)dictionary { | |
NSObject *instance = [[self.class alloc] init]; | |
objc_property_t *properties = class_copyPropertyList(self.class, NULL); | |
objc_property_t property; |
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
import Foundation | |
extension Int{ | |
var day: (Int, Calendar.Component) { | |
return (self, .day) | |
} | |
var month: (Int, Calendar.Component) { | |
return (self, .month) | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
func max(a:[Int], n:Int) -> Int | |
{ | |
var m = a[0] | |
for i in 0...(n - 1) { |