You an download a video to see the app running here.
- To turn you Mac into a Beacon download MactsAsBeacon and follow the instructions written in its README.
- Set the UUID as
9C07E0AB-EC3C-4968-9296-59A0579D0678
(unfortunatly MactsAsBeacon doesn't allow you to paste it 😅). - Run
iBeaconReceiver
on an iOS Device.
iBeaconReceiver sends an HTTP request every 4 seconds when there's the beacon near the device.
There are 2 tabs:
-
iBeacon
: used for the beacon recognition. The view gets red when there's no beacon, yellow when it's close to it and green when it's very close. -
Profile
: there are hardcoded some user info
In the project there a file Storyboard.swift which takes care to instantiate view controllers in a type-safe and declarative way.
In the project there a file TabItem.swift
which takes care to set the view controller's tabBarItem
property in a type-safe and declarative way.
The NetworkManager is extremely simple.
It's a singleton which has a Void
method that sends a HTTP Post request to an hardcoded API with a harcoded header.
It doesn't return any type of data because the response should not be used.
This network layer has an hardcoded style because it's extremely simple and the app is just a prototype. In a real app I would a network layer like the one I used here.
I used the Swift Pattern Matching (here is the line) to check is there's a recognized beacon or none.