Extensions giving Swift's Codable API type inference super powers 🦸♂️🦹♀️ - JohnSundell/Codextended

seen from Türkiye

seen from United States
seen from Germany

seen from United Kingdom
seen from United Kingdom
seen from United States
seen from Brazil
seen from Spain
seen from Pakistan

seen from United Kingdom

seen from United Kingdom
seen from Spain
seen from China
seen from Yemen

seen from United States
seen from Spain
seen from United Kingdom
seen from China
seen from Germany
seen from China
Extensions giving Swift's Codable API type inference super powers 🦸♂️🦹♀️ - JohnSundell/Codextended

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
How do you implement state preservation and restoration when your view controller model is a Swift struct that does not support NSCoding? My
How to: Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?
How to: Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?
Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?
I’d like to save an NSMutableDictionary object in NSUserDefaults. The key type in NSMutableDictionary is NSString, the value type is NSArray, which contains a list of object which implements NSCoding. Per document, NSString and NSArray both are conform to NSCoding.
I am getting this error:
[NSUserDefaults setObject: forKey:]:…
View On WordPress

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
A great explanation of an easily overlooked set of classes for persisting data, and comparison against the other, more popular choice - Core Data.
Creating a child mutable dictionary from parent mutable dictionary, with both being independent of each other
When we create a child mutable dictionary, which is an exact replica of another parent mutable dictionary, often there would be a situation, where you change value for one key of the child dictionary and the value for same key would be changed for the parent dictionary too.
And, vice-versa. Changing values for parent dictionary would reflect for the images of child dictionary.
For this, what we would have to do is, Deep Copy. And deep copy, in true sense, for NSMutableDictionary or NSMutableArray would be done very easily with NSCoding (serialization) protocol.
- (id) deepCopy:(id)mutableObjectToBeCopied
{
NSData *buffer = [NSKeyedArchiver archivedDataWithRootObject: mutableObjectToBeCopied];
return [NSKeyedUnarchiver unarchiveObjectWithData: buffer];
}
Harmless UINavigationController Swizzling — Redux
Forget all the hard work swizzling stuff and making things conform to NSCoding, it’s not always easy anyway. You can simply call -initWithRootController: twice. That’s the spirit.
UIViewController *emptyVC = [[[UIViewController alloc] init] autorelease]; __block WANavigationController *navController = [[[WANavigationController alloc] initWithRootViewController:emptyVC] autorelease]; navController = [[((^ { NSKeyedUnarchiver *unarchiver = [[[NSKeyedUnarchiver alloc] initForReadingWithData:[NSKeyedArchiver archivedDataWithRootObject:navController]] autorelease]; [unarchiver setClass:[WANavigationBar class] forClassName:@"UINavigationBar"]; [unarchiver setClass:[UIViewController class] forClassName:NSStringFromClass([navController.topViewController class])]; return unarchiver; })()) decodeObjectForKey:@"root"] initWithRootViewController:navController.topViewController];
If the (intended) root view controller was used to initialize the old navigation controller, its navigationController property will be totally messed up when it is pushed again to a new navigation controller. Even if the property passes an assertion. The idea is to hand a fake one to the old navigation controller since everything that is not related to the navigation controller’s view is not that important.