Commit b062bebd authored by Aral Balkan's avatar Aral Balkan

Update for Xcode 8 Beta 6

parent a8acc353
git "git@source.ind.ie:project/handle.git" "058e2b8b33bc2295d95a2aab8cb8a79ecd823041"
git "git@source.ind.ie:project/handle.git" "17f597747b1773149641836e8f35cd430f159134"
......@@ -40,10 +40,10 @@ public enum GlobalTouchNotification:String
}
public class GlobalTouchNotifications
open class GlobalTouchNotifications
{
/// Singleton
public class var sharedInstance:GlobalTouchNotifications
open class var sharedInstance:GlobalTouchNotifications
{
struct Static
{
......@@ -66,24 +66,24 @@ class GlobalTapGestureRecognizer: UITapGestureRecognizer
{
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent)
{
post(GlobalTouchNotification.named(.TouchesBegan), from: self, with: ["touches": touches, "event": event])
post(GlobalTouchNotification.named(.TouchesBegan), from: self, with: ["touches" as NSObject: touches as AnyObject, "event" as NSObject: event])
super.touchesBegan(touches, with: event)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent)
{
post(GlobalTouchNotification.named(.TouchesEnded), from: self, with: ["touches": touches, "event": event])
post(GlobalTouchNotification.named(.TouchesEnded), from: self, with: ["touches" as NSObject: touches as AnyObject, "event" as NSObject: event])
super.touchesEnded(touches, with: event)
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent)
{
post(GlobalTouchNotification.named(.TouchesCancelled), from: self, with: ["touches": touches, "event": event])
post(GlobalTouchNotification.named(.TouchesCancelled), from: self, with: ["touches" as NSObject: touches as AnyObject, "event" as NSObject: event])
super.touchesCancelled(touches, with: event)
}
override func touchesEstimatedPropertiesUpdated(_ touches: Set<UITouch>) {
post(GlobalTouchNotification.named(.TouchesEstimatedPropertiesUpdated), from: self, with: ["touches": touches])
post(GlobalTouchNotification.named(.TouchesEstimatedPropertiesUpdated), from: self, with: ["touches" as NSObject: touches as AnyObject])
super.touchesEstimatedPropertiesUpdated(touches)
}
}
......@@ -122,6 +122,7 @@
TargetAttributes = {
A7ADB9391C5A40E200826A76 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 5Q42VF5GXA;
LastSwiftMigration = 0800;
};
};
......@@ -293,6 +294,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 5Q42VF5GXA;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../Carthage/Build/iOS/**";
INFOPLIST_FILE = "GlobalTouchNotificationsDemo-iOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......@@ -309,6 +311,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 5Q42VF5GXA;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../Carthage/Build/iOS/**";
INFOPLIST_FILE = "GlobalTouchNotificationsDemo-iOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
......@@ -16,7 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
{
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: Any]?) -> Bool
{
return true
}
......
......@@ -47,7 +47,7 @@ class PopoverTableViewController: UITableViewController
// The super implementation calls init:nibName:bundle:
// so we need to redeclare that initializer to prevent a runtime crash.
super.init(style: UITableViewStyle.plain)
self.modalPresentationStyle = .popover
self.preferredContentSize = CGSize(width: 400, height: 400)
......@@ -64,7 +64,7 @@ class PopoverTableViewController: UITableViewController
// fatal error: use of unimplemented initializer 'init(nibName:bundle:)'
// for class 'TestViewController'
// I made this private since users should use the no-argument constructor.
private override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: Bundle!)
fileprivate override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: Bundle!)
{
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
......@@ -83,12 +83,10 @@ class PopoverTableViewController: UITableViewController
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return data.count
}
......
......@@ -16,7 +16,6 @@ import Handle
class ViewController: UIViewController, WKNavigationDelegate, UIPopoverPresentationControllerDelegate
{
var webView:WKWebView!
var lastTouch: UITouch?
var popoverViewController: UIViewController!
......@@ -47,22 +46,18 @@ class ViewController: UIViewController, WKNavigationDelegate, UIPopoverPresentat
webView = WKWebView(frame: self.view.frame)
webView.navigationDelegate = self
self.view.addSubview(webView)
webView.navigationDelegate = self
webView.loadHTMLString("<head><meta name='viewport' content='width=device-width; initial-scale=1.0'><style>body {margin-top: 40px; background-color: #eee;}</style></head><h1>Hello</h1><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p><p>This is <a href='#'>a link</a></p>.", baseURL: nil)
popoverViewController = PopoverTableViewController()
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) {
print(navigationAction)
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
{
if let lastTouch = lastTouch
{
print ("I know what you touched last summer.")
guard let myPopoverPresentationController = popoverViewController.popoverPresentationController else { fatalError("Couldn’t get popover presentation controller") }
myPopoverPresentationController.permittedArrowDirections = .any
myPopoverPresentationController.sourceView = self.view
......
......@@ -4,6 +4,8 @@ A singleton that broadcasts touch events from the main window as notifications.
**This is the Swift 3 branch.** Also available: [Master (Swift 2.2.1)](https://source.ind.ie/project/global-touch-notifications/tree/master) and [Swift 2.3](https://source.ind.ie/project/global-touch-notifications/tree/swift-2.3) branches.
**Supported on:** Xcode 8 Beta 6
## Installation
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
......
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