These commands are good as of 2011-07-27.
App store http://itunes.apple.com/us/app/xcode/id448457090?mt=12) The download/install takes awhile so start it first. When it finishes downloading you will still need to run it to complete installation.
import SwiftUI | |
/** | |
hack to avoid crashes on window close, and remove the window from the | |
NSApplication stack, ie: avoid leaking window objects | |
*/ | |
fileprivate final class WindowDelegate: NSObject, NSWindowDelegate { | |
func windowShouldClose(_ sender: NSWindow) -> Bool { | |
NSApp.removeWindowsItem(sender) | |
return true |
@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. |
// UIInterfaceOrientationMask vs. UIInterfaceOrientation | |
// As far as I know, a function like this isn't available in the API. I derived this from the enum def for | |
// UIInterfaceOrientationMask. | |
inline BOOL OrientationMaskSupportsOrientation(UIInterfaceOrientationMask mask, UIInterfaceOrientation orientation) { | |
return (mask & (1 << orientation)) != 0; | |
} |
import Cocoa | |
import CoreGraphics | |
extension NSScreen { | |
var displayID: CGDirectDisplayID { | |
return deviceDescription["NSScreenNumber"] as? CGDirectDisplayID ?? 0 | |
} | |
} |
/// A type that has an "empty" representation. | |
public protocol EmptyRepresentable { | |
static func empty() -> Self | |
} | |
extension Array: EmptyRepresentable { | |
public static func empty() -> Array<Element> { | |
return Array() | |
} | |
} |
/* | |
File: Reachability.h | |
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. | |
Version: 2.2 - ARCified | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. | |
("Apple") in consideration of your agreement to the following terms, and your | |
use, installation, modification or redistribution of this Apple software |
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
These commands are good as of 2011-07-27.
App store http://itunes.apple.com/us/app/xcode/id448457090?mt=12) The download/install takes awhile so start it first. When it finishes downloading you will still need to run it to complete installation.
Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.
Reset PS3 controller by inserting paperclip into pinhole near L2 button.
Connect PS3 controller to Mac with USB cable.
Enable Bluetooth.
@interface NSWindow (Fade) | |
- (IBAction)fadeIn:(id)sender; | |
- (IBAction)fadeOut:(id)sender; | |
@end |