Skip to content

Instantly share code, notes, and snippets.

@loplopLover
loplopLover / String.swift
Created December 7, 2015 03:38 — forked from loiclefloch/String.swift
Swift usefull extensions
extension String
{
var length: Int {
get {
return count(self)
}
}
func contains(s: String) -> Bool
{
@loplopLover
loplopLover / String.swift
Created December 7, 2015 03:05 — forked from abarax/String.swift
String extensions for Swift
import Foundation
extension String
{
var length: Int {
get {
return self.characters.count
}
}
@loplopLover
loplopLover / PushNotificationManager.swift
Created November 13, 2015 13:45 — forked from takecian/PushNotificationManager.swift
Utility functions for iOS PushNotification
class PushNotificationManager {
class var isPushNotificationEnable: Bool {
let osVersion = UIDevice.currentDevice().systemVersion
if osVersion < "8.0" {
let types = UIApplication.sharedApplication().enabledRemoteNotificationTypes()
if types == UIRemoteNotificationType.None {
// push notification disabled
return false
}else{
// push notification enable
@loplopLover
loplopLover / NSObject+PublicClass.swift
Created November 13, 2015 09:30
Determine if a random NSObject subclass instance is a public or private framework (does not test for your objects)
import Foundation
extension NSObject {
var isPublicClass: Bool {
return self.dynamicType.isPublicClass
}
class var isPublicClass: Bool {
return _PUBLIC_IOS_CLASSES.contains(NSStringFromClass(self))
}