This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Scenario: | |
| We have iPads at various locations... | |
| Users have iPhones, with an "Act as a BLE beacon" app, using the Service UUID as an identifier... | |
| The iPads need to respond when a user gets in range... | |
| The iPads *also* have to respond to any other BLE in range... | |
| So far, not a big deal. However... | |
| When the iPhone app goes background, it can ONLY broadcast the Service UUID, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Show an In-Progress indicator (such as a spinner)... | |
| Make the Request... | |
| Alamofire.request(.GET, url, parameters: ["id": site.pressureSensorID]) | |
| .responseJSON { response in | |
| // async call has returned... | |
| switch response.result { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "main" ViewController.swift | |
| import UIKit | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)runTestURL:(id)sender { | |
| // 1 | |
| NSString *dataUrl = @"https://someurl.com"; | |
| NSURL *url = [NSURL URLWithString:dataUrl]; | |
| // 2 | |
| NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:url | |
| completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
| // 4: Handle response here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this is ViewController.h | |
| #import <UIKit/UIKit.h> | |
| @interface ViewController : UIViewController | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // return proportional scaled size, with max width and height | |
| func scaledSize(origSZ: CGSize, targSZ:CGSize) -> CGSize? { | |
| var lNewW = targSZ.width | |
| var lNewH = (origSZ.height / origSZ.width) * targSZ.width | |
| if (lNewH > targSZ.height) { | |
| lNewH = targSZ.height | |
| lNewW = (origSZ.width / origSZ.height) * targSZ.height |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| #import "ViewController.h" | |
| #import <WebKit/WebKit.h> | |
| @interface ViewController () | |
| @property (strong, nonatomic) UIWebView *theWebView; | |
| @property (strong, nonatomic) WKWebView *wkWebView; | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Foo { | |
| var names: Set<String> = [] | |
| var numbers: Set<Int> = [] | |
| var otherNumbers: Set<Double> = [] | |
| func setNames<S: SequenceType where S.Generator.Element == String>(seq: S) -> Foo { | |
| var new = self | |
| new.names = Set(seq) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in AppDelegate.swift | |
| import UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <UIKit/UIKit.h> | |
| @interface DMView : UIView | |
| @property (strong, nonatomic) UIColor *bkgColor; | |
| - (id)initWithFrame:(CGRect)frame color:(UIColor *)color; | |
| @end |