├── iBeaconSwiftOSX.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── marcelo.xcuserdatad
│ │ └── xcdebugger
│ │ └── Expressions.xcexplist
├── xcuserdata
│ └── marcelo.xcuserdatad
│ │ ├── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── iBeaconSwifOSX.xcscheme
│ │ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
└── project.pbxproj
├── iBeaconSwiftOSX
├── AppDelegate.swift
├── CBTransmitterDelegate.swift
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── CBBeaconTransmitterProtocol.swift
├── Info.plist
├── CBBeaconAvertisementDataProtocol.swift
├── CBBeaconTransmitter.swift
├── CBBeaconAvertisementData.swift
├── ViewController.swift
└── Base.lproj
│ └── Main.storyboard
├── iBeaconSwiftOSXTests
├── Info.plist
└── iBeaconSwiftOSXTests.swift
├── README.md
└── LICENSE
/iBeaconSwiftOSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX.xcodeproj/xcuserdata/marcelo.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SuppressBuildableAutocreation
6 |
7 | 9CEA74501A0F53CF00A64F80
8 |
9 | primary
10 |
11 |
12 | 9CEA74621A0F53CF00A64F80
13 |
14 | primary
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/9/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | @NSApplicationMain
12 | class AppDelegate: NSObject, NSApplicationDelegate {
13 |
14 | func applicationDidFinishLaunching(aNotification: NSNotification) {
15 | // Insert code here to initialize your application
16 | }
17 |
18 | func applicationWillTerminate(aNotification: NSNotification) {
19 | // Insert code here to tear down your application
20 | }
21 |
22 |
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSXTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.MarcNet.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/CBTransmitterDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CBTransmitterDelegate.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/13/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 |
20 | import Foundation
21 | import CoreBluetooth
22 |
23 | protocol CBTransmitterDelegate {
24 | var isAdvertising: Bool? { get set }
25 | func transmitterDidPoweredOn(isPoweredOn: Bool)
26 | func transmitterDidStartAdvertising(isAdvertising: Bool)
27 | }
28 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX.xcodeproj/project.xcworkspace/xcuserdata/marcelo.xcuserdatad/xcdebugger/Expressions.xcexplist:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSXTests/iBeaconSwiftOSXTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // iBeaconSwiftOSXTests.swift
3 | // iBeaconSwiftOSXTests
4 | //
5 | // Created by Marcelo Gigirey on 11/9/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import XCTest
11 |
12 | class iBeaconSwiftOSXTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | XCTAssert(true, "Pass")
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock() {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | iBeaconSwiftOSX
2 | ===
3 |
4 | [Yosemite as an iBeacon](https://updatemycode.com/2014/11/29/yosemite-as-an-ibeacon-swift/) written in Swift.
5 |
6 | This application runs on Yosemite (OS X 10.10).
7 |
8 | Initially based on [BeaconOSX](https://github.com/mttrb/BeaconOSX) written in Objective-C for Mavericks by Matthew Robinson.
9 |
10 | **Note**: Despite to the fact that many forums are saying that you cannot use Yosemite as an iBeacon, I can confirm that this solution is working but only with external Bluetooth dongle.
11 | http://stackoverflow.com/a/27542365/3824765.
12 |
13 | License
14 | ===
15 |
16 | Created by Marcelo Gigirey on 11/9/14.
17 | Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
18 |
19 | Licensed under the Apache License, Version 2.0 (the "License");
20 | you may not use this file except in compliance with the License.
21 | You may obtain a copy of the License at
22 |
23 | http://www.apache.org/licenses/LICENSE-2.0
24 |
25 | Unless required by applicable law or agreed to in writing, software
26 | distributed under the License is distributed on an "AS IS" BASIS,
27 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 | See the License for the specific language governing permissions and
29 | limitations under the License.
30 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/CBBeaconTransmitterProtocol.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CBBeaconTransmitterProtocol.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/13/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 |
20 | import Foundation
21 | import CoreBluetooth
22 | import CoreLocation
23 |
24 | protocol CBBeaconTransmitterProtocol: CBPeripheralManagerDelegate {
25 | var beaconData: CBBeaconAvertisementData! { get set }
26 | var delegate: CBTransmitterDelegate? { get set }
27 |
28 | func setUpBeacon(proximityUUID uuid: NSUUID?, major M: CLBeaconMajorValue?, minor m: CLBeaconMinorValue?, measuredPower power: Int8?)
29 | func startTransmitting()
30 | func stopTransmitting()
31 | }
32 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.MarcNet.$(PRODUCT_NAME:rfc1034identifier)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSApplicationCategoryType
26 | public.app-category.developer-tools
27 | LSMinimumSystemVersion
28 | $(MACOSX_DEPLOYMENT_TARGET)
29 | NSHumanReadableCopyright
30 | Copyright © 2014 Marcelo Gigirey. All rights reserved.
31 | NSMainStoryboardFile
32 | Main
33 | NSPrincipalClass
34 | NSApplication
35 |
36 |
37 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/CBBeaconAvertisementDataProtocol.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CBBeaconAvertisementDataProtocol.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/5/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 | // Portions of this code are from BLCBeaconAdvertisement.h, part of BeaconOSX under this license:
21 | //
22 | // Copyright (c) 2013, Matthew Robinson
23 | // All rights reserved.
24 | //
25 | // Redistribution and use in source and binary forms, with or without modification,
26 | // are permitted provided that the following conditions are met:
27 | //
28 | // 1. Redistributions of source code must retain the above copyright notice, this
29 | // list of conditions and the following disclaimer.
30 | //
31 | // 2. Redistributions in binary form must reproduce the above copyright notice,
32 | // this list of conditions and the following disclaimer in the documentation
33 | // and/or other materials provided with the distribution.
34 | //
35 | // 3. Neither the name of Blended Cocoa nor the names of its contributors may
36 | // be used to endorse or promote products derived from this software without
37 | // specific prior written permission.
38 | //
39 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
40 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 | // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
43 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 | // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
45 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
46 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48 | // POSSIBILITY OF SUCH DAMAGE.
49 | //
50 | //
51 | //
52 | // BLCBeaconAdvertisementData.h
53 | // BeaconOSX
54 | //
55 | // Created by Matthew Robinson on 1/11/2013.
56 | //
57 |
58 | import Foundation
59 | import CoreLocation
60 |
61 | protocol CBBeaconAvertisementDataProtocol {
62 | var proximityUUID: NSUUID { get set }
63 | var major: CLBeaconMajorValue { get set }
64 | var minor: CLBeaconMinorValue { get set }
65 | var measuredPower: Int8 { get set }
66 |
67 | init(proximityUUID: NSUUID?, major: CLBeaconMajorValue?, minor: CLBeaconMinorValue?, measuredPower: Int8?)
68 |
69 | func beaconAdvertisement() -> NSDictionary?
70 | }
71 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/CBBeaconTransmitter.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CBBeaconTransmitter.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/5/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 |
20 | import Foundation
21 | import CoreBluetooth
22 | import CoreLocation
23 |
24 | private var once = dispatch_once_t()
25 |
26 | final class CBBeaconTransmitter: NSObject, CBBeaconTransmitterProtocol {
27 | // Properties
28 | var manager: CBPeripheralManager!
29 | var beaconData: CBBeaconAvertisementData!
30 | var delegate: CBTransmitterDelegate?
31 |
32 | override init() {
33 | super.init()
34 | // http://stackoverflow.com/a/24137213/3824765
35 | dispatch_once(&once) {
36 | self.manager = CBPeripheralManager(delegate: self, queue: nil)
37 | }
38 | }
39 |
40 | // Set Up
41 | func setUpBeacon(proximityUUID uuid: NSUUID?, major M: CLBeaconMajorValue?, minor m: CLBeaconMinorValue?, measuredPower power: Int8?) {
42 | beaconData = CBBeaconAvertisementData(proximityUUID: uuid!, major: M!, minor: m!, measuredPower: power!)
43 | }
44 |
45 | // Transmitting
46 | func startTransmitting() {
47 | if let advertisement = beaconData.beaconAdvertisement() {
48 | println(advertisement)
49 | manager.startAdvertising(advertisement)
50 | }
51 | }
52 |
53 | func stopTransmitting() {
54 | manager.stopAdvertising()
55 | //manager.delegate = nil
56 | delegate?.transmitterDidStartAdvertising(false)
57 | println("Advertising our iBeacon Stopped")
58 | }
59 |
60 |
61 | // CBPeripheralManager Delegate
62 | func peripheralManagerDidUpdateState(peripheral: CBPeripheralManager!) {
63 | print("The peripheral state is ")
64 | switch peripheral.state {
65 | case .PoweredOff:
66 | println("Powered off")
67 | case .PoweredOn:
68 | println("Powered on")
69 | case .Resetting:
70 | println("Resetting")
71 | case .Unauthorized:
72 | println("Unauthorized")
73 | case .Unknown:
74 | println("Unknown")
75 | case .Unsupported:
76 | println("Unsupported")
77 | }
78 |
79 | let isPoweredOn = peripheral.state == CBPeripheralManagerState.PoweredOn ? true : false
80 | delegate?.transmitterDidPoweredOn(isPoweredOn)
81 | }
82 |
83 | func peripheralManagerDidStartAdvertising(peripheral: CBPeripheralManager!, error: NSError!) {
84 | if error == nil {
85 | println("Advertising our iBeacon Started")
86 | delegate?.transmitterDidStartAdvertising(true)
87 | } else {
88 | println("Failed to advertise iBeacon. Error = \(error)")
89 | delegate?.transmitterDidStartAdvertising(false)
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX.xcodeproj/xcuserdata/marcelo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
30 |
31 |
32 |
34 |
46 |
47 |
48 |
50 |
62 |
63 |
64 |
66 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/CBBeaconAvertisementData.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CBBeaconAvertisementData.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/5/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 | // Portions of this code are from BLCBeaconAdvertisement.m, part of BeaconOSX under this license:
21 | //
22 | // Copyright (c) 2013, Matthew Robinson
23 | // All rights reserved.
24 | //
25 | // Redistribution and use in source and binary forms, with or without modification,
26 | // are permitted provided that the following conditions are met:
27 | //
28 | // 1. Redistributions of source code must retain the above copyright notice, this
29 | // list of conditions and the following disclaimer.
30 | //
31 | // 2. Redistributions in binary form must reproduce the above copyright notice,
32 | // this list of conditions and the following disclaimer in the documentation
33 | // and/or other materials provided with the distribution.
34 | //
35 | // 3. Neither the name of Blended Cocoa nor the names of its contributors may
36 | // be used to endorse or promote products derived from this software without
37 | // specific prior written permission.
38 | //
39 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
40 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 | // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
43 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 | // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
45 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
46 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48 | // POSSIBILITY OF SUCH DAMAGE.
49 | //
50 | //
51 | //
52 | // BLCBeaconAdvertisementData.m
53 | // BeaconOSX
54 | //
55 | // Created by Matthew Robinson on 1/11/2013.
56 | //
57 |
58 |
59 | import Foundation
60 | import CoreBluetooth
61 | import CoreLocation
62 |
63 | final class CBBeaconAvertisementData: NSObject, CBBeaconAvertisementDataProtocol {
64 | // Properties
65 | var proximityUUID: NSUUID
66 | var major: CLBeaconMajorValue
67 | var minor: CLBeaconMinorValue
68 | var measuredPower: Int8
69 |
70 | init(proximityUUID: NSUUID?, major: CLBeaconMajorValue?, minor: CLBeaconMinorValue?, measuredPower: Int8?) {
71 | self.proximityUUID = proximityUUID!
72 | self.major = major!
73 | self.minor = minor!
74 | self.measuredPower = measuredPower!
75 | }
76 |
77 | func beaconAdvertisement() -> NSDictionary? {
78 | let bufferSize = 21
79 | let beaconKey: NSString = "kCBAdvDataAppleBeaconKey";
80 |
81 | var advertisementBytes = [CUnsignedChar](count: bufferSize, repeatedValue: 0)
82 |
83 | proximityUUID.getUUIDBytes(&advertisementBytes)
84 |
85 | advertisementBytes[16] = CUnsignedChar(major >> 8)
86 | advertisementBytes[17] = CUnsignedChar(major & 255)
87 |
88 | advertisementBytes[18] = CUnsignedChar(minor >> 8)
89 | advertisementBytes[19] = CUnsignedChar(minor & 255)
90 |
91 | // http://stackoverflow.com/a/25667091/3824765
92 | advertisementBytes[20] = CUnsignedChar(bitPattern: measuredPower)
93 |
94 | // http://stackoverflow.com/questions/24196820/nsdata-from-byte-array-in-swift
95 | let advertisement = NSData(bytes: advertisementBytes, length: bufferSize)
96 |
97 | return NSDictionary(object: advertisement, forKey: beaconKey)
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX.xcodeproj/xcuserdata/marcelo.xcuserdatad/xcschemes/iBeaconSwifOSX.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // iBeaconSwiftOSX
4 | //
5 | // Created by Marcelo Gigirey on 11/9/14.
6 | // Copyright (c) 2014 Marcelo Gigirey. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 |
20 | import Cocoa
21 | import Foundation
22 | import CoreBluetooth
23 |
24 | class ViewController: NSViewController, CBTransmitterDelegate {
25 | // Properties
26 | var isAdvertising: Bool?
27 | //var isReadyForAdvertising : Bool?
28 | var transmitter : CBBeaconTransmitter?
29 |
30 | // Constants
31 | let kCBUserDefaultsUDID = "kCBUserDefaultsUDID"
32 | let kCBCUserDefaultsMajor = "kCBCUserDefaultsMajor"
33 | let kCBCUserDefaultsMinor = "kCBCUserDefaultsMinor"
34 | let kCBCUserDefaultsMeasuredPower = "kCBCUserDefaultsMeasuredPower"
35 |
36 | @IBOutlet weak var uuidTextField: NSTextFieldCell!
37 | @IBOutlet weak var majorTextField: NSTextField!
38 | @IBOutlet weak var minorTextField: NSTextField!
39 | @IBOutlet weak var measuredPowerTextField: NSTextField!
40 | @IBOutlet weak var generateUUIDButton: NSButton!
41 | @IBOutlet weak var startButton: NSButton!
42 |
43 | override func viewDidLoad() {
44 | super.viewDidLoad()
45 |
46 | isAdvertising = false
47 | //isReadyForAdvertising = false
48 |
49 | transmitter = CBBeaconTransmitter()
50 | transmitter?.delegate = self
51 |
52 | // Retrieve Values from NSUserDefaults
53 | loadUserDefaults()
54 | }
55 |
56 | override var representedObject: AnyObject? {
57 | didSet {
58 | // Update the view, if already loaded.
59 | }
60 | }
61 |
62 | func loadUserDefaults() {
63 | var udid : NSString? = NSUserDefaults.standardUserDefaults().stringForKey(kCBUserDefaultsUDID)
64 | if udid != nil {
65 | uuidTextField.stringValue = "\(udid!)"
66 | }
67 |
68 | var major : NSString? = NSUserDefaults.standardUserDefaults().stringForKey(kCBCUserDefaultsMajor)
69 | if major != nil {
70 | majorTextField.stringValue = "\(major!)"
71 | }
72 |
73 | var minor : NSString? = NSUserDefaults.standardUserDefaults().stringForKey(kCBCUserDefaultsMinor)
74 | if minor != nil {
75 | minorTextField.stringValue = "\(minor!)"
76 | }
77 |
78 | var measuredPower : NSString? = NSUserDefaults.standardUserDefaults().stringForKey(kCBCUserDefaultsMeasuredPower)
79 | if measuredPower != nil {
80 | measuredPowerTextField.stringValue = "\(measuredPower!)"
81 | }
82 | }
83 |
84 | @IBAction func startButtonClicked(sender: AnyObject) {
85 | // Transmit
86 | if !isAdvertising! {
87 | // Store Values in NSUserDefaults
88 | NSUserDefaults.standardUserDefaults().setObject(uuidTextField.stringValue, forKey: kCBUserDefaultsUDID)
89 | NSUserDefaults.standardUserDefaults().setObject(majorTextField.stringValue, forKey: kCBCUserDefaultsMajor)
90 | NSUserDefaults.standardUserDefaults().setObject(minorTextField.stringValue, forKey: kCBCUserDefaultsMinor)
91 | NSUserDefaults.standardUserDefaults().setObject(measuredPowerTextField.stringValue, forKey: kCBCUserDefaultsMeasuredPower)
92 |
93 | transmitAsBeacon()
94 | }
95 | else {
96 | stopBeacon()
97 | }
98 | }
99 |
100 | @IBAction func genereateUUIDClicked(sender: AnyObject) {
101 | uuidTextField.stringValue = "\(NSUUID().UUIDString)"
102 | }
103 |
104 | // Transmit as iBeacon
105 | func transmitAsBeacon() {
106 | transmitter?.setUpBeacon(proximityUUID: NSUUID(UUIDString: uuidTextField.stringValue)!,
107 | major: UInt16(majorTextField.integerValue),
108 | minor: UInt16(minorTextField.integerValue),
109 | measuredPower: Int8(measuredPowerTextField.integerValue))
110 | transmitter?.startTransmitting()
111 | }
112 |
113 | func stopBeacon() {
114 | transmitter?.stopTransmitting()
115 | }
116 |
117 | func toggleControls(beaconStatus: BeaconStatus) {
118 | switch beaconStatus
119 | {
120 | case .Advertising:
121 | startButton.title = "Turn iBeacon off"
122 | startButton.enabled = true
123 | enableControls(false)
124 | case .NotAdvertising:
125 | startButton.title = "Turn iBeacon on"
126 | startButton.enabled = true
127 | enableControls(true)
128 | case .ResumeAdvertise:
129 | transmitAsBeacon()
130 | startButton.enabled = true
131 | enableControls(false)
132 | case .CannotAdvertise:
133 | startButton.enabled = false
134 | enableControls(false)
135 | }
136 | }
137 |
138 | func enableControls(enabled: Bool) {
139 | generateUUIDButton.enabled = enabled
140 | uuidTextField.enabled = enabled
141 | majorTextField.enabled = enabled
142 | minorTextField.enabled = enabled
143 | measuredPowerTextField.enabled = enabled
144 | }
145 |
146 | func transmitterDidPoweredOn(isPoweredOn: Bool) {
147 | if isPoweredOn {
148 | toggleControls(isAdvertising! ? BeaconStatus.ResumeAdvertise : BeaconStatus.NotAdvertising)
149 | }
150 | else {
151 | toggleControls(BeaconStatus.CannotAdvertise)
152 | }
153 | }
154 |
155 | func transmitterDidStartAdvertising(isAdvertising: Bool) {
156 | self.isAdvertising = isAdvertising
157 | toggleControls(isAdvertising == true ? BeaconStatus.Advertising : BeaconStatus.NotAdvertising)
158 | }
159 |
160 | enum BeaconStatus {
161 | case Advertising
162 | case NotAdvertising
163 | case ResumeAdvertise
164 | case CannotAdvertise
165 | }
166 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------
/iBeaconSwiftOSX.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 9CE1B1C91A13863400DAFC72 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CE1B1C81A13863400DAFC72 /* CoreLocation.framework */; };
11 | 9CEA74571A0F53CF00A64F80 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74561A0F53CF00A64F80 /* AppDelegate.swift */; };
12 | 9CEA74591A0F53CF00A64F80 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74581A0F53CF00A64F80 /* ViewController.swift */; };
13 | 9CEA745B1A0F53CF00A64F80 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9CEA745A1A0F53CF00A64F80 /* Images.xcassets */; };
14 | 9CEA745E1A0F53CF00A64F80 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CEA745C1A0F53CF00A64F80 /* Main.storyboard */; };
15 | 9CEA746A1A0F53CF00A64F80 /* iBeaconSwiftOSXTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74691A0F53CF00A64F80 /* iBeaconSwiftOSXTests.swift */; };
16 | 9CEA74781A0F574C00A64F80 /* CBBeaconAvertisementData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74751A0F574C00A64F80 /* CBBeaconAvertisementData.swift */; };
17 | 9CEA74791A0F574C00A64F80 /* CBBeaconAvertisementDataProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74761A0F574C00A64F80 /* CBBeaconAvertisementDataProtocol.swift */; };
18 | 9CEA747A1A0F574C00A64F80 /* CBBeaconTransmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEA74771A0F574C00A64F80 /* CBBeaconTransmitter.swift */; };
19 | 9CEFB9CD1A1510E7006BC247 /* CBBeaconTransmitterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CEFB9CC1A1510E7006BC247 /* CBBeaconTransmitterProtocol.swift */; };
20 | 9CF357D91A11F145004FBF7E /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CF357D81A11F145004FBF7E /* CoreBluetooth.framework */; };
21 | 9CFB67651A14EA9300847AA1 /* CBTransmitterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CFB67641A14EA9300847AA1 /* CBTransmitterDelegate.swift */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | 9CEA74641A0F53CF00A64F80 /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = 9CEA74491A0F53CF00A64F80 /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = 9CEA74501A0F53CF00A64F80;
30 | remoteInfo = iBeaconSwiftOSX;
31 | };
32 | /* End PBXContainerItemProxy section */
33 |
34 | /* Begin PBXFileReference section */
35 | 9CE1B1C81A13863400DAFC72 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
36 | 9CEA74511A0F53CF00A64F80 /* iBeaconSwiftOSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iBeaconSwiftOSX.app; sourceTree = BUILT_PRODUCTS_DIR; };
37 | 9CEA74551A0F53CF00A64F80 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
38 | 9CEA74561A0F53CF00A64F80 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
39 | 9CEA74581A0F53CF00A64F80 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
40 | 9CEA745A1A0F53CF00A64F80 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
41 | 9CEA745D1A0F53CF00A64F80 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
42 | 9CEA74631A0F53CF00A64F80 /* iBeaconSwiftOSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iBeaconSwiftOSXTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 9CEA74681A0F53CF00A64F80 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
44 | 9CEA74691A0F53CF00A64F80 /* iBeaconSwiftOSXTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iBeaconSwiftOSXTests.swift; sourceTree = ""; };
45 | 9CEA74751A0F574C00A64F80 /* CBBeaconAvertisementData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CBBeaconAvertisementData.swift; sourceTree = ""; };
46 | 9CEA74761A0F574C00A64F80 /* CBBeaconAvertisementDataProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CBBeaconAvertisementDataProtocol.swift; sourceTree = ""; };
47 | 9CEA74771A0F574C00A64F80 /* CBBeaconTransmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CBBeaconTransmitter.swift; sourceTree = ""; };
48 | 9CEFB9CC1A1510E7006BC247 /* CBBeaconTransmitterProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CBBeaconTransmitterProtocol.swift; sourceTree = ""; };
49 | 9CF357D81A11F145004FBF7E /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
50 | 9CFB67641A14EA9300847AA1 /* CBTransmitterDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CBTransmitterDelegate.swift; sourceTree = ""; };
51 | /* End PBXFileReference section */
52 |
53 | /* Begin PBXFrameworksBuildPhase section */
54 | 9CEA744E1A0F53CF00A64F80 /* Frameworks */ = {
55 | isa = PBXFrameworksBuildPhase;
56 | buildActionMask = 2147483647;
57 | files = (
58 | 9CE1B1C91A13863400DAFC72 /* CoreLocation.framework in Frameworks */,
59 | 9CF357D91A11F145004FBF7E /* CoreBluetooth.framework in Frameworks */,
60 | );
61 | runOnlyForDeploymentPostprocessing = 0;
62 | };
63 | 9CEA74601A0F53CF00A64F80 /* Frameworks */ = {
64 | isa = PBXFrameworksBuildPhase;
65 | buildActionMask = 2147483647;
66 | files = (
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | /* End PBXFrameworksBuildPhase section */
71 |
72 | /* Begin PBXGroup section */
73 | 9CE59D7C1A18A5AC0006B67C /* Delegates */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 9CFB67641A14EA9300847AA1 /* CBTransmitterDelegate.swift */,
77 | );
78 | name = Delegates;
79 | sourceTree = "";
80 | };
81 | 9CEA74481A0F53CF00A64F80 = {
82 | isa = PBXGroup;
83 | children = (
84 | 9CE1B1C81A13863400DAFC72 /* CoreLocation.framework */,
85 | 9CF357D81A11F145004FBF7E /* CoreBluetooth.framework */,
86 | 9CEA74531A0F53CF00A64F80 /* iBeaconSwiftOSX */,
87 | 9CEA74661A0F53CF00A64F80 /* iBeaconSwiftOSXTests */,
88 | 9CEA74521A0F53CF00A64F80 /* Products */,
89 | );
90 | sourceTree = "";
91 | };
92 | 9CEA74521A0F53CF00A64F80 /* Products */ = {
93 | isa = PBXGroup;
94 | children = (
95 | 9CEA74511A0F53CF00A64F80 /* iBeaconSwiftOSX.app */,
96 | 9CEA74631A0F53CF00A64F80 /* iBeaconSwiftOSXTests.xctest */,
97 | );
98 | name = Products;
99 | sourceTree = "";
100 | };
101 | 9CEA74531A0F53CF00A64F80 /* iBeaconSwiftOSX */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 9CEA747B1A0F579200A64F80 /* iBeacon */,
105 | 9CEA74561A0F53CF00A64F80 /* AppDelegate.swift */,
106 | 9CEA74581A0F53CF00A64F80 /* ViewController.swift */,
107 | 9CEA745A1A0F53CF00A64F80 /* Images.xcassets */,
108 | 9CEA745C1A0F53CF00A64F80 /* Main.storyboard */,
109 | 9CEA74541A0F53CF00A64F80 /* Supporting Files */,
110 | );
111 | path = iBeaconSwiftOSX;
112 | sourceTree = "";
113 | };
114 | 9CEA74541A0F53CF00A64F80 /* Supporting Files */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 9CEA74551A0F53CF00A64F80 /* Info.plist */,
118 | );
119 | name = "Supporting Files";
120 | sourceTree = "";
121 | };
122 | 9CEA74661A0F53CF00A64F80 /* iBeaconSwiftOSXTests */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 9CEA74691A0F53CF00A64F80 /* iBeaconSwiftOSXTests.swift */,
126 | 9CEA74671A0F53CF00A64F80 /* Supporting Files */,
127 | );
128 | path = iBeaconSwiftOSXTests;
129 | sourceTree = "";
130 | };
131 | 9CEA74671A0F53CF00A64F80 /* Supporting Files */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 9CEA74681A0F53CF00A64F80 /* Info.plist */,
135 | );
136 | name = "Supporting Files";
137 | sourceTree = "";
138 | };
139 | 9CEA747B1A0F579200A64F80 /* iBeacon */ = {
140 | isa = PBXGroup;
141 | children = (
142 | 9CE59D7C1A18A5AC0006B67C /* Delegates */,
143 | 9CEFB9CE1A151112006BC247 /* Protocols */,
144 | 9CEA74771A0F574C00A64F80 /* CBBeaconTransmitter.swift */,
145 | 9CEA74751A0F574C00A64F80 /* CBBeaconAvertisementData.swift */,
146 | );
147 | name = iBeacon;
148 | sourceTree = "";
149 | };
150 | 9CEFB9CE1A151112006BC247 /* Protocols */ = {
151 | isa = PBXGroup;
152 | children = (
153 | 9CEA74761A0F574C00A64F80 /* CBBeaconAvertisementDataProtocol.swift */,
154 | 9CEFB9CC1A1510E7006BC247 /* CBBeaconTransmitterProtocol.swift */,
155 | );
156 | name = Protocols;
157 | sourceTree = "";
158 | };
159 | /* End PBXGroup section */
160 |
161 | /* Begin PBXNativeTarget section */
162 | 9CEA74501A0F53CF00A64F80 /* iBeaconSwiftOSX */ = {
163 | isa = PBXNativeTarget;
164 | buildConfigurationList = 9CEA746D1A0F53CF00A64F80 /* Build configuration list for PBXNativeTarget "iBeaconSwiftOSX" */;
165 | buildPhases = (
166 | 9CEA744D1A0F53CF00A64F80 /* Sources */,
167 | 9CEA744E1A0F53CF00A64F80 /* Frameworks */,
168 | 9CEA744F1A0F53CF00A64F80 /* Resources */,
169 | );
170 | buildRules = (
171 | );
172 | dependencies = (
173 | );
174 | name = iBeaconSwiftOSX;
175 | productName = iBeaconSwiftOSX;
176 | productReference = 9CEA74511A0F53CF00A64F80 /* iBeaconSwiftOSX.app */;
177 | productType = "com.apple.product-type.application";
178 | };
179 | 9CEA74621A0F53CF00A64F80 /* iBeaconSwiftOSXTests */ = {
180 | isa = PBXNativeTarget;
181 | buildConfigurationList = 9CEA74701A0F53CF00A64F80 /* Build configuration list for PBXNativeTarget "iBeaconSwiftOSXTests" */;
182 | buildPhases = (
183 | 9CEA745F1A0F53CF00A64F80 /* Sources */,
184 | 9CEA74601A0F53CF00A64F80 /* Frameworks */,
185 | 9CEA74611A0F53CF00A64F80 /* Resources */,
186 | );
187 | buildRules = (
188 | );
189 | dependencies = (
190 | 9CEA74651A0F53CF00A64F80 /* PBXTargetDependency */,
191 | );
192 | name = iBeaconSwiftOSXTests;
193 | productName = iBeaconSwiftOSXTests;
194 | productReference = 9CEA74631A0F53CF00A64F80 /* iBeaconSwiftOSXTests.xctest */;
195 | productType = "com.apple.product-type.bundle.unit-test";
196 | };
197 | /* End PBXNativeTarget section */
198 |
199 | /* Begin PBXProject section */
200 | 9CEA74491A0F53CF00A64F80 /* Project object */ = {
201 | isa = PBXProject;
202 | attributes = {
203 | LastUpgradeCheck = 0610;
204 | ORGANIZATIONNAME = "Marcelo Gigirey";
205 | TargetAttributes = {
206 | 9CEA74501A0F53CF00A64F80 = {
207 | CreatedOnToolsVersion = 6.1;
208 | SystemCapabilities = {
209 | com.apple.Sandbox = {
210 | enabled = 0;
211 | };
212 | };
213 | };
214 | 9CEA74621A0F53CF00A64F80 = {
215 | CreatedOnToolsVersion = 6.1;
216 | TestTargetID = 9CEA74501A0F53CF00A64F80;
217 | };
218 | };
219 | };
220 | buildConfigurationList = 9CEA744C1A0F53CF00A64F80 /* Build configuration list for PBXProject "iBeaconSwiftOSX" */;
221 | compatibilityVersion = "Xcode 3.2";
222 | developmentRegion = English;
223 | hasScannedForEncodings = 0;
224 | knownRegions = (
225 | en,
226 | Base,
227 | );
228 | mainGroup = 9CEA74481A0F53CF00A64F80;
229 | productRefGroup = 9CEA74521A0F53CF00A64F80 /* Products */;
230 | projectDirPath = "";
231 | projectRoot = "";
232 | targets = (
233 | 9CEA74501A0F53CF00A64F80 /* iBeaconSwiftOSX */,
234 | 9CEA74621A0F53CF00A64F80 /* iBeaconSwiftOSXTests */,
235 | );
236 | };
237 | /* End PBXProject section */
238 |
239 | /* Begin PBXResourcesBuildPhase section */
240 | 9CEA744F1A0F53CF00A64F80 /* Resources */ = {
241 | isa = PBXResourcesBuildPhase;
242 | buildActionMask = 2147483647;
243 | files = (
244 | 9CEA745B1A0F53CF00A64F80 /* Images.xcassets in Resources */,
245 | 9CEA745E1A0F53CF00A64F80 /* Main.storyboard in Resources */,
246 | );
247 | runOnlyForDeploymentPostprocessing = 0;
248 | };
249 | 9CEA74611A0F53CF00A64F80 /* Resources */ = {
250 | isa = PBXResourcesBuildPhase;
251 | buildActionMask = 2147483647;
252 | files = (
253 | );
254 | runOnlyForDeploymentPostprocessing = 0;
255 | };
256 | /* End PBXResourcesBuildPhase section */
257 |
258 | /* Begin PBXSourcesBuildPhase section */
259 | 9CEA744D1A0F53CF00A64F80 /* Sources */ = {
260 | isa = PBXSourcesBuildPhase;
261 | buildActionMask = 2147483647;
262 | files = (
263 | 9CEA74591A0F53CF00A64F80 /* ViewController.swift in Sources */,
264 | 9CEA74781A0F574C00A64F80 /* CBBeaconAvertisementData.swift in Sources */,
265 | 9CEA74791A0F574C00A64F80 /* CBBeaconAvertisementDataProtocol.swift in Sources */,
266 | 9CFB67651A14EA9300847AA1 /* CBTransmitterDelegate.swift in Sources */,
267 | 9CEA74571A0F53CF00A64F80 /* AppDelegate.swift in Sources */,
268 | 9CEFB9CD1A1510E7006BC247 /* CBBeaconTransmitterProtocol.swift in Sources */,
269 | 9CEA747A1A0F574C00A64F80 /* CBBeaconTransmitter.swift in Sources */,
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | 9CEA745F1A0F53CF00A64F80 /* Sources */ = {
274 | isa = PBXSourcesBuildPhase;
275 | buildActionMask = 2147483647;
276 | files = (
277 | 9CEA746A1A0F53CF00A64F80 /* iBeaconSwiftOSXTests.swift in Sources */,
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | };
281 | /* End PBXSourcesBuildPhase section */
282 |
283 | /* Begin PBXTargetDependency section */
284 | 9CEA74651A0F53CF00A64F80 /* PBXTargetDependency */ = {
285 | isa = PBXTargetDependency;
286 | target = 9CEA74501A0F53CF00A64F80 /* iBeaconSwiftOSX */;
287 | targetProxy = 9CEA74641A0F53CF00A64F80 /* PBXContainerItemProxy */;
288 | };
289 | /* End PBXTargetDependency section */
290 |
291 | /* Begin PBXVariantGroup section */
292 | 9CEA745C1A0F53CF00A64F80 /* Main.storyboard */ = {
293 | isa = PBXVariantGroup;
294 | children = (
295 | 9CEA745D1A0F53CF00A64F80 /* Base */,
296 | );
297 | name = Main.storyboard;
298 | sourceTree = "";
299 | };
300 | /* End PBXVariantGroup section */
301 |
302 | /* Begin XCBuildConfiguration section */
303 | 9CEA746B1A0F53CF00A64F80 /* Debug */ = {
304 | isa = XCBuildConfiguration;
305 | buildSettings = {
306 | ALWAYS_SEARCH_USER_PATHS = NO;
307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
308 | CLANG_CXX_LIBRARY = "libc++";
309 | CLANG_ENABLE_MODULES = YES;
310 | CLANG_ENABLE_OBJC_ARC = YES;
311 | CLANG_WARN_BOOL_CONVERSION = YES;
312 | CLANG_WARN_CONSTANT_CONVERSION = YES;
313 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
314 | CLANG_WARN_EMPTY_BODY = YES;
315 | CLANG_WARN_ENUM_CONVERSION = YES;
316 | CLANG_WARN_INT_CONVERSION = YES;
317 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
318 | CLANG_WARN_UNREACHABLE_CODE = YES;
319 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
320 | CODE_SIGN_IDENTITY = "-";
321 | COPY_PHASE_STRIP = NO;
322 | ENABLE_STRICT_OBJC_MSGSEND = YES;
323 | GCC_C_LANGUAGE_STANDARD = gnu99;
324 | GCC_DYNAMIC_NO_PIC = NO;
325 | GCC_OPTIMIZATION_LEVEL = 0;
326 | GCC_PREPROCESSOR_DEFINITIONS = (
327 | "DEBUG=1",
328 | "$(inherited)",
329 | );
330 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
333 | GCC_WARN_UNDECLARED_SELECTOR = YES;
334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
335 | GCC_WARN_UNUSED_FUNCTION = YES;
336 | GCC_WARN_UNUSED_VARIABLE = YES;
337 | MACOSX_DEPLOYMENT_TARGET = 10.10;
338 | MTL_ENABLE_DEBUG_INFO = YES;
339 | ONLY_ACTIVE_ARCH = YES;
340 | SDKROOT = macosx10.10;
341 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
342 | };
343 | name = Debug;
344 | };
345 | 9CEA746C1A0F53CF00A64F80 /* Release */ = {
346 | isa = XCBuildConfiguration;
347 | buildSettings = {
348 | ALWAYS_SEARCH_USER_PATHS = NO;
349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
350 | CLANG_CXX_LIBRARY = "libc++";
351 | CLANG_ENABLE_MODULES = YES;
352 | CLANG_ENABLE_OBJC_ARC = YES;
353 | CLANG_WARN_BOOL_CONVERSION = YES;
354 | CLANG_WARN_CONSTANT_CONVERSION = YES;
355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
356 | CLANG_WARN_EMPTY_BODY = YES;
357 | CLANG_WARN_ENUM_CONVERSION = YES;
358 | CLANG_WARN_INT_CONVERSION = YES;
359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
360 | CLANG_WARN_UNREACHABLE_CODE = YES;
361 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
362 | CODE_SIGN_IDENTITY = "-";
363 | COPY_PHASE_STRIP = YES;
364 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
365 | ENABLE_NS_ASSERTIONS = NO;
366 | ENABLE_STRICT_OBJC_MSGSEND = YES;
367 | GCC_C_LANGUAGE_STANDARD = gnu99;
368 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
369 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
370 | GCC_WARN_UNDECLARED_SELECTOR = YES;
371 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
372 | GCC_WARN_UNUSED_FUNCTION = YES;
373 | GCC_WARN_UNUSED_VARIABLE = YES;
374 | MACOSX_DEPLOYMENT_TARGET = 10.10;
375 | MTL_ENABLE_DEBUG_INFO = NO;
376 | SDKROOT = macosx10.10;
377 | };
378 | name = Release;
379 | };
380 | 9CEA746E1A0F53CF00A64F80 /* Debug */ = {
381 | isa = XCBuildConfiguration;
382 | buildSettings = {
383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
384 | COMBINE_HIDPI_IMAGES = YES;
385 | INFOPLIST_FILE = iBeaconSwiftOSX/Info.plist;
386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
387 | MACOSX_DEPLOYMENT_TARGET = 10.10;
388 | PRODUCT_NAME = "$(TARGET_NAME)";
389 | };
390 | name = Debug;
391 | };
392 | 9CEA746F1A0F53CF00A64F80 /* Release */ = {
393 | isa = XCBuildConfiguration;
394 | buildSettings = {
395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
396 | CLANG_USE_OPTIMIZATION_PROFILE = YES;
397 | COMBINE_HIDPI_IMAGES = YES;
398 | INFOPLIST_FILE = iBeaconSwiftOSX/Info.plist;
399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
400 | MACOSX_DEPLOYMENT_TARGET = 10.10;
401 | PRODUCT_NAME = "$(TARGET_NAME)";
402 | };
403 | name = Release;
404 | };
405 | 9CEA74711A0F53CF00A64F80 /* Debug */ = {
406 | isa = XCBuildConfiguration;
407 | buildSettings = {
408 | BUNDLE_LOADER = "$(TEST_HOST)";
409 | COMBINE_HIDPI_IMAGES = YES;
410 | FRAMEWORK_SEARCH_PATHS = (
411 | "$(DEVELOPER_FRAMEWORKS_DIR)",
412 | "$(inherited)",
413 | );
414 | GCC_PREPROCESSOR_DEFINITIONS = (
415 | "DEBUG=1",
416 | "$(inherited)",
417 | );
418 | INFOPLIST_FILE = iBeaconSwiftOSXTests/Info.plist;
419 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
420 | PRODUCT_NAME = "$(TARGET_NAME)";
421 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iBeaconSwiftOSX.app/Contents/MacOS/iBeaconSwiftOSX";
422 | };
423 | name = Debug;
424 | };
425 | 9CEA74721A0F53CF00A64F80 /* Release */ = {
426 | isa = XCBuildConfiguration;
427 | buildSettings = {
428 | BUNDLE_LOADER = "$(TEST_HOST)";
429 | COMBINE_HIDPI_IMAGES = YES;
430 | FRAMEWORK_SEARCH_PATHS = (
431 | "$(DEVELOPER_FRAMEWORKS_DIR)",
432 | "$(inherited)",
433 | );
434 | INFOPLIST_FILE = iBeaconSwiftOSXTests/Info.plist;
435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
436 | PRODUCT_NAME = "$(TARGET_NAME)";
437 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iBeaconSwiftOSX.app/Contents/MacOS/iBeaconSwiftOSX";
438 | };
439 | name = Release;
440 | };
441 | /* End XCBuildConfiguration section */
442 |
443 | /* Begin XCConfigurationList section */
444 | 9CEA744C1A0F53CF00A64F80 /* Build configuration list for PBXProject "iBeaconSwiftOSX" */ = {
445 | isa = XCConfigurationList;
446 | buildConfigurations = (
447 | 9CEA746B1A0F53CF00A64F80 /* Debug */,
448 | 9CEA746C1A0F53CF00A64F80 /* Release */,
449 | );
450 | defaultConfigurationIsVisible = 0;
451 | defaultConfigurationName = Release;
452 | };
453 | 9CEA746D1A0F53CF00A64F80 /* Build configuration list for PBXNativeTarget "iBeaconSwiftOSX" */ = {
454 | isa = XCConfigurationList;
455 | buildConfigurations = (
456 | 9CEA746E1A0F53CF00A64F80 /* Debug */,
457 | 9CEA746F1A0F53CF00A64F80 /* Release */,
458 | );
459 | defaultConfigurationIsVisible = 0;
460 | defaultConfigurationName = Release;
461 | };
462 | 9CEA74701A0F53CF00A64F80 /* Build configuration list for PBXNativeTarget "iBeaconSwiftOSXTests" */ = {
463 | isa = XCConfigurationList;
464 | buildConfigurations = (
465 | 9CEA74711A0F53CF00A64F80 /* Debug */,
466 | 9CEA74721A0F53CF00A64F80 /* Release */,
467 | );
468 | defaultConfigurationIsVisible = 0;
469 | defaultConfigurationName = Release;
470 | };
471 | /* End XCConfigurationList section */
472 | };
473 | rootObject = 9CEA74491A0F53CF00A64F80 /* Project object */;
474 | }
475 |
--------------------------------------------------------------------------------
/iBeaconSwiftOSX/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
--------------------------------------------------------------------------------