-com.apple.CoreData.SQLDebug 1-3- print all SQL queries called by Core Data-com.apple.CoreData.Logging.stderr 1-3- needed alongside with theSQLDebugfrom iOS 10+ because of new logging system, more on that in changelog
-com.apple.CoreData.SyntaxtColoredLogging YES- probably syntax colored logging (not tried)-com.apple.CoreData.SQLiteDebugSynchronous 1- preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details-com.apple.CoreData.SQLiteIntegrityCheck 1- the SQLite store does extra integrity checking-com.apple.CoreData.MigrationDebug 1- Core Data will log information about exceptional cases as it migrates data-com.apple.CoreData.ThreadingDebug- preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where incre
| - (void)md5HashFromUIImage:(UIImage*)image | |
| hash:(unsigned char*)hash | |
| { | |
| CGDataProviderRef dataProvider = CGImageGetDataProvider(image.CGImage); | |
| NSData *data = (NSData*)CFBridgingRelease(CGDataProviderCopyData(dataProvider)); | |
| CC_MD5([data bytes], [data length], hash); | |
| } | |
| - (BOOL)compareUIImages:(UIImage*)image1 | |
| image:(UIImage*)image2 |
| #import <UIKit/UIKit.h> | |
| @interface IntrinsicTableView : UITableView | |
| @end |
This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.
The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.
Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.
| #ifndef NS_DESIGNATED_INITIALIZER | |
| #if __has_attribute(objc_designated_initializer) | |
| #define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer)) | |
| #else | |
| #define NS_DESIGNATED_INITIALIZER | |
| #endif | |
| #endif |
| //////////////////////////////////////////////// | |
| // | |
| // Swift and Objective-C Class Parsing | |
| // | |
| //////////////////////////////////////////////// | |
| import Foundation | |
| // Class parsing |
In this article, I'm going to explore a way that we can create views that implement custom Core Animation property animations in a natural way.
As we know, layers in iOS come in two flavours: Backing layers and hosted layers. The only difference between them is that the view acts as the layer delegate for its backing layer, but not for any hosted sublayers.
In order to implement the UIView transactional animation blocks, UIView disables all animations by default and then re-enables them individually as required. It does this using the actionForLayer:forKey: method.
Somewhat strangely, UIView doesn't enable animations for every property that CALayer does by default. A notable example is the layer.contents property, which is animatable by default for a hosted layer, but cannot be animated using a UIView animation block.
Suppose we want to add support for a new iOS 8 API in our framework that replaces an older iOS 7 API. There are a few problems we might face:
- The new API will crash if we call it on iOS 7
- The new API won't compile if we build it using the iOS 7 SDK
- The old API will raise a deprecation warning if built with a deployment target of iOS 8 and up
These three problems require three different technical solutions:
- We can avoid calling the new API on an old OS version by using runtime detection (e.g.
respondsToSelector:) - We can avoid compiling new APIs on old SDKs using the
__IPHONE_OS_VERSION_MAX_ALLOWEDmacro
| struct もじれつ: Printable { | |
| let description: String | |
| init(string: String) { | |
| var mutableString = NSMutableString(string: string) as CFMutableString | |
| if CFStringTransform(mutableString, nil, kCFStringTransformLatinHiragana, 0) == 1 { | |
| self.description = mutableString as NSString | |
| } else { | |
| self.description = string | |
| } |
| // | |
| // BitwiseOptions.swift | |
| // | |
| // Created by Gregory Higley on 11/24/14. | |
| // Copyright (c) 2014 Prosumma LLC. All rights reserved. | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |