mirror of
https://github.com/UrbanApps/Armchair.git
synced 2026-03-28 12:21:59 +01:00
Update for Xcode 6.1 and Swift 1.1
This commit is contained in:
@@ -591,7 +591,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
|
||||
PRODUCT_NAME = Armchair;
|
||||
SDKROOT = macosx;
|
||||
@@ -615,7 +615,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
|
||||
PRODUCT_NAME = Armchair;
|
||||
SDKROOT = macosx;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
// @NSApplicationMain // TODO - Needs Xcode 6.1 beta 2 to compile. Figure out a way to support both for the time being
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@IBOutlet weak var window: NSWindow!
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6246" systemVersion="14A238x" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6246"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
@@ -675,7 +675,7 @@
|
||||
<window title="Mac Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="400" height="368"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="368"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
||||
@@ -213,12 +213,13 @@ extension ViewController {
|
||||
}
|
||||
|
||||
@IBAction func openUrbanApps(AnyObject) {
|
||||
let url = NSURL(string: "http://urbanapps.com")
|
||||
if let url = NSURL(string: "http://urbanapps.com") {
|
||||
#if os(iOS)
|
||||
UIApplication.sharedApplication().openURL(url)
|
||||
UIApplication.sharedApplication().openURL(url)
|
||||
#elseif os(OSX)
|
||||
NSWorkspace.sharedWorkspace().openURL(url)
|
||||
NSWorkspace.sharedWorkspace().openURL(url)
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,8 +621,7 @@ public enum ArmchairKey: String, Printable {
|
||||
|
||||
public var description : String {
|
||||
get {
|
||||
return self.toRaw()
|
||||
// return self.rawValue // Changes to rawValue in Xcode 6.1 beta 2
|
||||
return self.rawValue
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -920,7 +919,11 @@ public class Manager : ArmchairManager {
|
||||
var incrementKey = keyForArmchairKeyType(incrementKeyType)
|
||||
|
||||
// App's version. Not settable as the other ivars because that would be crazy.
|
||||
var currentVersion: String = NSBundle.mainBundle().infoDictionary[kCFBundleVersionKey] as NSString
|
||||
let currentVersion = NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleVersionKey) as? NSString
|
||||
if currentVersion == nil {
|
||||
assertionFailure("Could not read kCFBundleVersionKey from InfoDictionary")
|
||||
return
|
||||
}
|
||||
|
||||
// Get the version number that we've been tracking thus far
|
||||
var currentVersionKey = keyForArmchairKeyType(ArmchairKey.CurrentVersion)
|
||||
@@ -1137,7 +1140,7 @@ public class Manager : ArmchairManager {
|
||||
}))
|
||||
|
||||
// get the top most controller (= the StoreKit Controller) and dismiss it
|
||||
if let presentingController = UIApplication.sharedApplication().keyWindow.rootViewController {
|
||||
if let presentingController = UIApplication.sharedApplication().keyWindow?.rootViewController {
|
||||
if let topController = topMostViewController(presentingController) {
|
||||
topController.presentViewController(alertView, animated: usesAnimation) {
|
||||
println("presentViewController() completed")
|
||||
@@ -1172,7 +1175,7 @@ public class Manager : ArmchairManager {
|
||||
alert.informativeText = reviewMessage
|
||||
alert.addButtonWithTitle(rateButtonTitle)
|
||||
if showsRemindButton() {
|
||||
alert.addButtonWithTitle(remindButtonTitle)
|
||||
alert.addButtonWithTitle(remindButtonTitle!)
|
||||
}
|
||||
alert.addButtonWithTitle(cancelButtonTitle)
|
||||
ratingAlert = alert
|
||||
@@ -1225,7 +1228,7 @@ public class Manager : ArmchairManager {
|
||||
modalPanelOpen = false
|
||||
|
||||
// get the top most controller (= the StoreKit Controller) and dismiss it
|
||||
if let presentingController = UIApplication.sharedApplication().keyWindow.rootViewController {
|
||||
if let presentingController = UIApplication.sharedApplication().keyWindow?.rootViewController {
|
||||
if let topController = topMostViewController(presentingController) {
|
||||
topController.dismissViewControllerAnimated(usesAnimation) {
|
||||
if let closure = self.didDismissModalViewClosure {
|
||||
@@ -1325,8 +1328,9 @@ public class Manager : ArmchairManager {
|
||||
|
||||
//Use the standard openUrl method
|
||||
} else {
|
||||
let url = NSURL(string: reviewURLString())
|
||||
UIApplication.sharedApplication().openURL(url)
|
||||
if let url = NSURL(string: reviewURLString()) {
|
||||
UIApplication.sharedApplication().openURL(url)
|
||||
}
|
||||
}
|
||||
|
||||
if UIDevice.currentDevice().model.rangeOfString("Simulator") != nil {
|
||||
@@ -1337,10 +1341,11 @@ public class Manager : ArmchairManager {
|
||||
debugLog(" - Or try copy/pasting \(fakeURL) into a browser on your computer.")
|
||||
}
|
||||
#elseif os(OSX)
|
||||
var url = NSURL(string: reviewURLString())
|
||||
var opened = NSWorkspace.sharedWorkspace().openURL(url)
|
||||
if !opened {
|
||||
debugLog("Failed to open \(url)")
|
||||
if let url = NSURL(string: reviewURLString()) {
|
||||
var opened = NSWorkspace.sharedWorkspace().openURL(url)
|
||||
if !opened {
|
||||
debugLog("Failed to open \(url)")
|
||||
}
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
@@ -1592,23 +1597,25 @@ public class Manager : ArmchairManager {
|
||||
}
|
||||
|
||||
private func getRootViewController() -> UIViewController? {
|
||||
var window: UIWindow = UIApplication.sharedApplication().keyWindow
|
||||
if window.windowLevel != UIWindowLevelNormal {
|
||||
var windows: NSArray = UIApplication.sharedApplication().windows
|
||||
for window in windows {
|
||||
if window.windowLevel == UIWindowLevelNormal {
|
||||
break
|
||||
if let window = UIApplication.sharedApplication().keyWindow {
|
||||
|
||||
if window.windowLevel != UIWindowLevelNormal {
|
||||
var windows: NSArray = UIApplication.sharedApplication().windows
|
||||
for window in windows {
|
||||
if window.windowLevel == UIWindowLevelNormal {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for subView in window.subviews {
|
||||
var nextResponder: UIResponder? = subView.nextResponder()
|
||||
if let responder = nextResponder {
|
||||
if responder.isKindOfClass(UIViewController) {
|
||||
return topMostViewController(responder as? UIViewController)
|
||||
for subView in window.subviews {
|
||||
var nextResponder: UIResponder? = subView.nextResponder()
|
||||
if let responder = nextResponder {
|
||||
if responder.isKindOfClass(UIViewController) {
|
||||
return topMostViewController(responder as? UIViewController)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user