Skip to content

Instantly share code, notes, and snippets.

@aurozhkov
aurozhkov / BLE.swift
Created September 25, 2016 05:21
BLE detecting
import CoreBluetooth
let kServiceUUID = CBUUID(string: "0000a000-0000-1000-8000-00805f9b34fb")
let kCharacteristicUUID = CBUUID(string: "0000a001-0000-1000-8000-00805f9b34fb")
let centralManager = CBCentralManager(delegate: self, queue: nil)
var foundDevice: CBPeripheral?
public func centralManagerDidUpdateState(central: CBCentralManager) {
if centralManager.state == .PoweredOn {
@aurozhkov
aurozhkov / iBeacon.swift
Last active September 25, 2016 05:44
iBeacons finding
import CoreLocation
let beaconUUIDs = ["f7826da6-4fa2-4e98-8024-bc5b71e0893e"]
let locationManager = CLLocationManager()
locationManager.delegate = self
for uuid in beaconUUIDs {
let beaconRegion = CLBeaconRegion(proximityUUID: NSUUID(UUIDString:uuid)!, identifier: uuid)
manager.startMonitoringForRegion(beaconRegion)
@aurozhkov
aurozhkov / UIDoubleTapAndMoveGestureRecognizer.swift
Last active December 21, 2015 05:30
UIDoubleTapAndMoveGestureRecognizer
import UIKit
import UIKit.UIGestureRecognizerSubclass
class UIDoubleTapAndMoveGestureRecognizer : UIGestureRecognizer {
private var timer : NSTimer?
private var isFirstTapDetected = false
private var isDoubleTapDetected = false
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent) {