Skip to content

Instantly share code, notes, and snippets.

@paulw11
paulw11 / Info.plist
Last active January 29, 2018 23:50
HKTest
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
if let url = URL(string: "https://www.agoda.com/pages/agoda/default/DestinationSearchResult.aspx?pcs=1&cid=1807795&hl=en&city=16594") {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
class Father {
public func doSomething() {
print("Did the father thing")
}
}
class Child: Father {
@available (*, unavailable)
override func doSomething() {
print("did the child thing")
func doSetup(){
service = CBMutableService(type: CBUUID(string: "00001000-0000-1000-8000-00805F9B34FB"), primary: true)
characteristic = CBMutableCharacteristic(type: CBUUID(string: "00001001-0000-1000-8000-00805F9B34FB"), properties: [CBCharacteristicProperties.read, CBCharacteristicProperties.write, CBCharacteristicProperties.notify], value: nil, permissions: [CBAttributePermissions.readable, CBAttributePermissions.writeable])
service?.characteristics = [characteristic!]
peripheralManager?.add(service!)
}
func startAdvertising {
peripheralManager?.startAdvertising([CBAdvertisementDataLocalNameKey: UIDevice.current.name, CBAdvertisementDataServiceUUIDsKey: [CBUUID(string: "00001000-0000-1000-8000-00805F9B34FB")]])
NSLog("Started advertising")
import Foundation
import UIKit
class RegionTest {
var region: CGPath!
var points = [CGPoint]()
init?() {
guard let regionCoordinates = self.loadJson(filename:"pointlist"),
protocol Revisionable {
}
class RealType: Revisionable {
}
#import "ViewController.h"
#import <Network/Network.h>
@interface ViewController ()
@property (strong,nonatomic) nw_path_monitor_t pathMonitor;
@end
@implementation ViewController
//
// BLEManager.swift
// BLEQuestion
//
// Created by Paul Wilkinson on 30/3/19.
// Copyright © 2019 Paul Wilkinson. All rights reserved.
//
import Foundation
import CoreBluetooth
mageView.leadingAnchor.constraint(equalToSystemSpacingAfter: contentView.leadingAnchor, multiplier: 1.0).isActive = true
imageView.widthAnchor.constraint(equalToConstant: 35.0).isActive = true
imageView.heightAnchor.constraint(equalToConstant: 35.0).isActive = true
textLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: imageView.trailingAnchor, multiplier: 1.0).isActive = true
likeButton.leadingAnchor.constraint(equalToSystemSpacingAfter: textLabel.trailingAnchor, multiplier: 1.0).isActive = true
likeButton.widthAnchor.constraint(equalToConstant: 50.0).isActive = true
contentView.trailingAnchor.constraint(equalTo: likeButton.trailingAnchor, constant: -2.0).isActive = true
func startUpdatingLocation() {
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.activityType = .fitness
self.locationManager.startUpdatingLocation()
}
extension ViewController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
if status == .authorizedWhenInUse {
self.startUpdatingLocation()