#Cocoapods
##Installing Cocoapods
- Open Terminal
- Enter command:
sudo gem install cocoapods
- Enter your password
Wait for this to finish, don't touch your terminal. It might take a couple minutes
// | |
// LGWatchKitListener.swift | |
// RemoteCamera | |
// | |
// Created by Logan Wright on 11/19/14. | |
// Copyright (c) 2014 lowriDevs. All rights reserved. | |
// | |
import UIKit |
extension NSObject { | |
class var propertyNames: [String] { | |
get { | |
var count: UInt32 = 0 | |
let properties: UnsafeMutablePointer<objc_property_t> = class_copyPropertyList(self.classForCoder(), &count) | |
var propertyNames: [String] = [] | |
for i in 0..<count { | |
let property: objc_property_t = properties[Int(i)] | |
if let name = String(UTF8String: property_getName(property)) { | |
propertyNames += [name] |
- (MKCoordinateRegion)regionForCoords:(NSArray *)coords withPaddingFactor:(CGFloat)paddingFactor { | |
CLLocationDegrees minLat = 90.0; | |
CLLocationDegrees maxLat = -90.0; | |
CLLocationDegrees minLon = 180.0; | |
CLLocationDegrees maxLon = -180.0; | |
for (NSValue *val in coords) { | |
CLLocationCoordinate2D coord = [val MKCoordinateValue]; | |
if (coord.latitude < minLat) { |
#import <Foundation/Foundation.h> | |
@interface MITTelephoneHandler : NSObject | |
+ (void)attemptToCallPhoneNumber:(NSString *)phoneNumber; | |
@end |
#import <UIKit/UIKit.h> | |
@interface UIView (NibInitable) | |
- (instancetype)initWithNibNamed:(NSString *)nibNameOrNil; | |
@end |
#import <UIKit/UIKit.h> | |
@interface LGMarginLabel : UILabel | |
@property (nonatomic) UIEdgeInsets marginInsets; | |
@end |
// | |
// Contact.swift | |
// FriendLender | |
// | |
// Created by Logan Wright on 9/22/14. | |
// Copyright (c) 2014 lowriDevs. All rights reserved. | |
// | |
import UIKit | |
import AddressBook |
#Cocoapods
##Installing Cocoapods
sudo gem install cocoapods
Wait for this to finish, don't touch your terminal. It might take a couple minutes
// | |
// MEApplicationSettings.swift | |
// MagicEyes | |
// | |
// Created by Logan Wright on 12/26/14. | |
// Copyright (c) 2014 Intrepid Pursuits, LLC. All rights reserved. | |
// | |
import UIKit |
Count the number of binary 1 flags for a given positive integer. For instance:
1 = 0b1 => 1 bit 2 = 0b10 => 1 bit 3 = 0b11 => 2 bits
Recursively
func countBitsRec(var n: NSInteger) -> NSInteger {
return n == 0 ? 0 : n & 1 + countBits(n >> 1)