Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.
Built with D3.js.
Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.
Built with D3.js.
Drag from an existing node to add a new node or link. Hit the DELETE key to remove the selected node or link.
Built with D3.js.
// before | |
func formattedAddress() -> String { | |
let lines:NSMutableArray = NSMutableArray(capacity: 4) | |
let zipStateCityArgs:NSMutableArray = NSMutableArray(capacity: 3) | |
let zip = self.stringValueForKeyPath("address_zip") | |
let city = self.stringValueForKeyPath("address_city") | |
let state = self.stringValueForKeyPath("address_state") | |
for arg in [zip, city, state] { |
protocol StringDecodable { | |
init?(string: String) | |
} | |
extension Dictionary where Key: JSONKey, Value: AnyObject { | |
/// Converts a string to an enum value | |
func enumFrom<T: StringDecodable>(key: Key, _ enumType: T.Type) -> T? { | |
if let s = self[key] as? String { | |
return enumType.init(string: s) | |
} |
import Cocoa | |
protocol Pet { | |
var name : String { get } | |
func renamed(newName: String) -> Self | |
} | |
struct Fish : Pet { | |
let name : String | |
func renamed(newName: String) -> Fish { |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> | |
<dictionary title="Dictionary"> | |
<suite name="Spotify Suite" code="spfy" description="Spotify specific classes."> | |
<enumeration name="ePlS" code="ePlS"> | |
<enumerator name="stopped" code="kPSS"> | |
<cocoa integer-value="0"/> | |
</enumerator> | |
<enumerator name="playing" code="kPSP"> | |
<cocoa integer-value="1"/> |
Assuming that you don't care which NSManagedObjectContext is used, and you just want to make some changes and save them in the background, use the following method. 90% of the time, this is what you'll want.
NSManagedObjectSubclass *myObject = [NSManagedObjectSubclass MR_findFirst];
[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
import Foundation | |
infix operator | {} | |
func | (lhs: String, rhs: String) -> String { | |
return NSLocalizedString(lhs, comment: rhs) | |
} | |
postfix operator | {} | |
postfix func | (s: String) -> String { | |
return NSLocalizedString(s, comment: "") | |
} |
Swift is modern, type-safe, expressive, performant
but Objective-C remains a first-class citizen
Same design patterns, Cocoa APIs
"We do not want you to rewrite or stop improving your existing code!"
Should you use unowned
or weak
for delegates?
To expose Objective-C to Swift, use a bridging header