AAAA.h
#import <Foundation/Foundation.h>
@interface AAAA : NSObject
@property NSMutableArray* dogs;| for old in *.m; do mv $old `basename $old .m`.mm; done |
AAAA.h
#import <Foundation/Foundation.h>
@interface AAAA : NSObject
@property NSMutableArray* dogs;| TAGS="TODO:|FIXME:" | |
| find "${SRCROOT}" -not -path "${SRCROOT}/Pods/*" \( -name "*.h" -or -name "*.m" -or -name "*.swift" -type f \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 300, 200)]; | |
| view.backgroundColor = [UIColor blueColor]; | |
| [self.view addSubview:view]; | |
| [view addObserver:self forKeyPath:@"frame" options:0 context:NULL]; |
| @interface UIColor (Random) | |
| + (instancetype)randomColor; | |
| @end | |
| @implementation UIColor (Random) | |
| + (instancetype)randomColor | |
| { |
| import UIKit | |
| import PlaygroundSupport | |
| class MyViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Main view | |
| self.view.backgroundColor = .black |
A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.
Both UITableView and UICollectionView offer a similar API to register custom cell classes:
public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)| //: Playground - noun: a place where people can play | |
| import Foundation | |
| extension String { | |
| func matchs(for regex: String) -> [String] { | |
| let regex = try! NSRegularExpression(pattern: regex, options: []) | |
| let matchs = regex.matches(in: self, options: [], range: NSRange(location: 0, length: characters.count)) | |
| return matchs.map { (self as NSString).substring(with: $0.range) } | |
| } |
| class HairlineConstraint: NSLayoutConstraint { | |
| override func awakeFromNib() { | |
| super.awakeFromNib() | |
| constant = 1.0 / UIScreen.mainScreen().scale | |
| } | |
| } |
| public struct Queues { | |
| static var GlobalMainQueue: dispatch_queue_t { | |
| return dispatch_get_main_queue() | |
| } | |
| static var GlobalUserInteractiveQueue: dispatch_queue_t { | |
| return dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0) | |
| } | |
| static var GlobalUserInitiatedQueue: dispatch_queue_t { |