Commit 4e103ed3 authored by Aral Balkan's avatar Aral Balkan

Update for Xcode 8 Beta 5 (Swift 3)

parent b205a223
git "git@source.ind.ie:project/handle.git" "c187932824dde0306981aa9184f8fea5abb0d645"
git "git@source.ind.ie:project/handle.git" "058e2b8b33bc2295d95a2aab8cb8a79ecd823041"
......@@ -93,7 +93,7 @@ public class CancellableDelayedCommand
}
// Set up the delayed dispatch.
DispatchQueue.main.after(when: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC))
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC))
{
dispatch_block_t in
......
......@@ -118,6 +118,7 @@
TargetAttributes = {
A7C0EB691C2441C800110179 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
};
};
......@@ -214,7 +215,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
......@@ -255,7 +256,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
......@@ -274,6 +275,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ind.ie.DelayDemo-OSX";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
......@@ -290,6 +292,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ind.ie.DelayDemo-OSX";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
......
......@@ -13,11 +13,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(aNotification: NSNotification) {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(aNotification: NSNotification) {
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
......
......@@ -46,7 +46,7 @@ class OSXViewController: NSViewController
override func viewWillAppear()
{
textDidChangeNotificationHandler = handle(NSControlTextDidChangeNotification, from:throttledTextField)
textDidChangeNotificationHandler = handle(NSNotification.Name.NSControlTextDidChange.rawValue, from:throttledTextField)
{
/* with */ notification in
......@@ -56,19 +56,19 @@ class OSXViewController: NSViewController
//
self.cancellableTextFieldLookupCommand = self.cancellableTextFieldLookupCommand?.reset() ?? delay(0.3)
{
let options: NSLinguisticTaggerOptions = [.OmitWhitespace, .OmitPunctuation, .JoinNames]
let schemes = NSLinguisticTagger.availableTagSchemesForLanguage("en")
let options: NSLinguisticTagger.Options = [.omitWhitespace, .omitPunctuation, .joinNames]
let schemes = NSLinguisticTagger.availableTagSchemes(forLanguage: "en")
let tagger = NSLinguisticTagger(tagSchemes: schemes, options: Int(options.rawValue))
let text = self.throttledTextField.stringValue
tagger.string = text
var linguisticBreakdownOfText = ""
tagger.enumerateTagsInRange(NSMakeRange(0, (text as NSString).length), scheme: NSLinguisticTagSchemeNameTypeOrLexicalClass, options: options)
tagger.enumerateTags(in: NSMakeRange(0, (text as NSString).length), scheme: NSLinguisticTagSchemeNameTypeOrLexicalClass, options: options)
{
(tag, tokenRange, sentenceRange, _) in
let token = (text as NSString).substringWithRange(tokenRange)
let token = (text as NSString).substring(with: tokenRange)
linguisticBreakdownOfText += "\(token): \(tag)\n"
}
......@@ -88,17 +88,17 @@ class OSXViewController: NSViewController
// MARK: - Actions
//
@IBAction func threeSecondsButtonAction(sender: NSButton)
@IBAction func threeSecondsButtonAction(_ sender: NSButton)
{
threeSecondDelayLabel.stringValue = "Waiting…"
delay(3)
_ = delay(3)
{
self.threeSecondDelayLabel.stringValue = "Done!"
}
}
@IBAction func fiveSecondsButtonAction(sender: NSButton)
@IBAction func fiveSecondsButtonAction(_ sender: NSButton)
{
fiveSecondDelayLabel.stringValue = "Waiting…"
......@@ -109,7 +109,7 @@ class OSXViewController: NSViewController
}
@IBAction func cancelFiveSecondDelayButtonAction(sender: NSButton)
@IBAction func cancelFiveSecondDelayButtonAction(_ sender: NSButton)
{
// Note: you can also check if a command had been cancelled
// by examining its .cancelled property (Bool).
......
......@@ -14,7 +14,6 @@
A787D47E1C24867500CDBF66 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A787D47D1C24867500CDBF66 /* Assets.xcassets */; };
A787D4811C24867500CDBF66 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A787D47F1C24867500CDBF66 /* LaunchScreen.storyboard */; };
A787D48D1C24871A00CDBF66 /* Handle.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = A787D48C1C24871A00CDBF66 /* Handle.framework.dSYM */; };
A7D97E361CA4073D007C185B /* Handle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7D97E351CA4073D007C185B /* Handle.framework */; };
A7E2C25F1CA43ACB00CD92AE /* Delay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7394BDC1CA435C70096FF28 /* Delay.framework */; };
A7E2C2601CA43ACB00CD92AE /* Delay.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A7394BDC1CA435C70096FF28 /* Delay.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
......@@ -61,7 +60,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A7D97E361CA4073D007C185B /* Handle.framework in Frameworks */,
A7E2C25F1CA43ACB00CD92AE /* Delay.framework in Frameworks */,
A7394BDD1CA435C70096FF28 /* Delay.framework in Frameworks */,
);
......
......@@ -82,11 +82,11 @@ class IOSViewController: UIViewController, UITextFieldDelegate
// print("Keyboard visibility will change: \(notification)")
if let
userInfo = notification.userInfo,
keyboardFrameBegin = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue(),
keyboardFrameEnd = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue(),
animationDuration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue
if
let userInfo = notification.userInfo,
let keyboardFrameBegin = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue,
let keyboardFrameEnd = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let animationDuration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue
{
let keyboardFrameBeginLocalRect = self.view.convert(keyboardFrameBegin, from: self.view.window)
let keyboardFrameEndLocalRect = self.view.convert(keyboardFrameEnd, from: self.view.window)
......@@ -129,7 +129,7 @@ class IOSViewController: UIViewController, UITextFieldDelegate
@IBAction func threeSecondsButtonAction(_ sender: UIButton)
{
threeSecondDelayLabel.text = "Waiting…"
delay(3)
_ = delay(3)
{
self.threeSecondDelayLabel.text = "Done!"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment