From 1194c482e58918237a64d87882d2f445ca433dab Mon Sep 17 00:00:00 2001 From: Lukas Bachschwell Date: Sun, 3 Jan 2016 11:44:36 +0100 Subject: [PATCH] Initial Commit --- ClockTurn.xcodeproj/project.pbxproj | 3 ++ ClockTurn/AppDelegate.swift | 1 + ClockTurn/Base.lproj/Main.storyboard | 58 ++++++++++++++++++++++++++-- ClockTurn/Info.plist | 7 +++- ClockTurn/ViewController.swift | 38 ++++++++++++++++++ 5 files changed, 101 insertions(+), 6 deletions(-) diff --git a/ClockTurn.xcodeproj/project.pbxproj b/ClockTurn.xcodeproj/project.pbxproj index b71d35b..25ffaa4 100644 --- a/ClockTurn.xcodeproj/project.pbxproj +++ b/ClockTurn.xcodeproj/project.pbxproj @@ -248,6 +248,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ClockTurn/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lbs.ClockTurn; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -259,6 +260,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ClockTurn/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lbs.ClockTurn; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -284,6 +286,7 @@ 2BD975581C11A1EF006975BD /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/ClockTurn/AppDelegate.swift b/ClockTurn/AppDelegate.swift index 6bcc80d..34031c5 100644 --- a/ClockTurn/AppDelegate.swift +++ b/ClockTurn/AppDelegate.swift @@ -16,6 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. + return true } diff --git a/ClockTurn/Base.lproj/Main.storyboard b/ClockTurn/Base.lproj/Main.storyboard index 3a2a49b..c5584c9 100644 --- a/ClockTurn/Base.lproj/Main.storyboard +++ b/ClockTurn/Base.lproj/Main.storyboard @@ -1,25 +1,75 @@ - + - + - + - + + + + + + + + + diff --git a/ClockTurn/Info.plist b/ClockTurn/Info.plist index 6905cc6..2ea3512 100644 --- a/ClockTurn/Info.plist +++ b/ClockTurn/Info.plist @@ -22,6 +22,11 @@ 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -33,8 +38,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight diff --git a/ClockTurn/ViewController.swift b/ClockTurn/ViewController.swift index 288d7a0..36d9c06 100644 --- a/ClockTurn/ViewController.swift +++ b/ClockTurn/ViewController.swift @@ -10,6 +10,7 @@ import UIKit class ViewController: UIViewController { + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. @@ -20,6 +21,43 @@ class ViewController: UIViewController { // Dispose of any resources that can be recreated. } + @IBAction func forward(sender: AnyObject) { + self.sendClock("forward") + } + + @IBAction func normal(sender: AnyObject) { + self.sendClock("normal") + } + + @IBAction func backward(sender: AnyObject) { + self.sendClock("backward") + } + + @IBAction func ignite(sender: AnyObject) { + self.sendClock("ig3") //does an ignite for 5 seconds in the clock.... + } + + + + func sendClock(macro: String){ + let request = NSMutableURLRequest(URL: NSURL(string: "http://192.168.0.205:8080/" + macro)!) + request.HTTPMethod = "POST" + //let postString = "" // the body, empty in our case + //request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding) + let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { + data, response, error in + + if error != nil { + print("error=\(error)") + return + } + print("response = \(response)") + + let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding) + print("responseString = \(responseString)") + } + task.resume() + } }