This file contains hidden or 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
| extension String { | |
| var containsEmoji: Bool { | |
| for scalar in unicodeScalars { | |
| switch scalar.value { | |
| case 0x1F600...0x1F64F, // Emoticons | |
| 0x1F300...0x1F5FF, // Misc Symbols and Pictographs | |
| 0x1F680...0x1F6FF, // Transport and Map | |
| 0x2600...0x26FF, // Misc symbols | |
| 0x2700...0x27BF, // Dingbats |
This file contains hidden or 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 <Contacts/Contacts.h> | |
| @implementation ContactsScan | |
| - (void) contactScan | |
| { | |
| if ([CNContactStore class]) { | |
| //ios9 or later | |
| CNEntityType entityType = CNEntityTypeContacts; | |
| if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined) |
This file contains hidden or 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
| let gradient = CAGradientLayer() | |
| gradient.frame = tableView.superview?.bounds ?? CGRectNull | |
| gradient.colors = [UIColor.clearColor().CGColor, UIColor.clearColor().CGColor, UIColor.blackColor().CGColor, UIColor.blackColor().CGColor, UIColor.clearColor().CGColor, UIColor.clearColor().CGColor] | |
| gradient.locations = [0.0, 0.15, 0.25, 0.75, 0.85, 1.0] | |
| tableView.superview?.layer.mask = gradient | |
| tableView.backgroundColor = UIColor.clearColor() |
This file contains hidden or 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
| @implementation UIImage (scale) | |
| /** | |
| * Scales an image to fit within a bounds with a size governed by | |
| * the passed size. Also keeps the aspect ratio. | |
| * | |
| * Switch MIN to MAX for aspect fill instead of fit. | |
| * | |
| * @param newSize the size of the bounds the image must fit within. | |
| * @return a new scaled image. |