Skip to content

Instantly share code, notes, and snippets.

- (NSNumber *)badgeNumberForNotificationsJson:(NSDictionary *)json {
return ([[json objectForKey:kToast] objectForKey:kNotificationNumber]);
}
- (NSNumber *)badgeNumberForNotificationsJson:(NSDictionary *)json {
return ([[json dictionaryForKey:kToast] numberForKey:kNotificationNumber]);
}
- (NSInteger)badgeNumberForNotificationsJson:(NotificationsDataModel *)model {
return model.toast.notificationNumber;
}
{
"toast": {
notificationNumber: 3,
notificationText: "John Appleseed invited you to connect"
},
"updateBadge": true,
"memberId": "134241252",
"connectionDistance": 3
}
@interface NotificationDataModel
@property (nonatomic, strong) NotificationToastModel *toast;
@property (nonatomic) BOOL updateBadge;
@property (nonatomic, strong) NSString *updateBadge;
@property (nonatomic) NSInteger connectionDistance;
@end
@interface NotificationToastModel
NotificationDataModel *model = [jsonDictionary isc_objectFromJSONWithClass:[NotificationDataModel class]];
[self updateNotificationCount:model.toast.notificationNumber];
@implementation NotificationDataModel
@end
@implementation NotificationToastModel
@end
- (id)copyWithZone:(NSZone *)zone {
LIProfilePersonModel *copy = [LIProfilePersonModel new];
copy.headline = self.headline;
copy.defaultLocale = self.defaultLocale;
copy.locationValue = self.locationValue;
copy.originalPicture = self.originalPicture;
copy.location = self.location;
...
@plivesey
plivesey / DataSpect.swift
Last active January 13, 2016 16:14
Swift LayoutTest Data Spec
class func dataSpecForTest() -> [NSObject: AnyObject] {
return [
"text": LYTStringValues(),
"buttonText": LYTStringValues(),
"buttonEnabled": LYTBoolValues(),
"imageType": LYTDataValues(values: ["linkedin", "customValue", NSNull()])
]
}
@plivesey
plivesey / ProtocolExtensionQuiz.swift
Last active August 8, 2016 21:55
See how many you can get right before running it... :D
//: Playground - noun: a place where people can play
import UIKit
// PROTOCOL
protocol Foo {
func foo() -> String
func baz() -> String
}