Skip to content

Commit

Permalink
Commit of version 1.4.0 - Please see CHANGELOG.md for further info.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMeier committed Apr 7, 2020
1 parent b3a6d9e commit b65a256
Show file tree
Hide file tree
Showing 23 changed files with 988 additions and 408 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OS X
.DS_Store

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

This file documents the changes between different versions of the `fliclib.framework` for the original Flic.

## fliclib-ios 1.4.0

### Significant Changes

* The framework is now distributed using the new XCFramework packaging format. This means that instead of a single `fliclib.framework` file, you will need to use a `fliclib.xcframework` bundle. This bundle is essentially a folder containing framework builds for all supported architectures. The main benefit of this is that the framework will from now on run in the iOS Simulator, by default, with no configuration needed.

This change switch was necessary due to the fact that Xcode 11.4 now throws a compiler error if any embedded framework is not build for Simulator. This would only generate a warning in previous versions. Thus the previously provided simulator files would no longer work without the use of cumbersome build scripts.

Xcode 11 is required in order to use XCFramework bundles.

## fliclib-ios 1.3.3

### Changes
Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@

This is the official iOS framework for the original **Flic 1**. If you are looking to integrate the new **Flic 2**, please see [https://github.com/50ButtonsEach/flic2lib-ios](https://github.com/50ButtonsEach/flic2lib-ios)

**Note:** As of `April 7th, 2020`, this framework is distributed as an XCFramework bundle instead of a regular framework bundle.

## Getting Started

This framework works in collaboration with the Flic app so please make sure that you have it installed before you begin. For instructions on how to implement this see [https://partners.flic.io/partners/developers/ios-tutorial](https://partners.flic.io/partners/developers/ios-tutorial), or take a look at one of our example projects here on github for [Swift](https://github.com/50ButtonsEach/ios-boilerplate-swift) or [Objective-C](https://github.com/50ButtonsEach/ios-boilerplate-objc).

## Simulator Support
***

**Note:** As of `April 7th, 2020`, the first 4 steps under the *Set up Xcode* section in the linked tutorial are no longer valid. Instead, replace them with the following 2 steps:

The framework itself does not contain slices for x86 and i386 (iOS Simulator). The reason for this is that if we were to add those slices to the framework then
they would have to be removed before App Store submission, which is not a very straightforward thing to do. So, for those who want to run the framework in the simulator
we instead provide a wrapper that adds a fake fliclib implementation when building for x86 and i386.
1. Place the downloaded `fliclib.xcframework` folder somewhere on you computer, preferably in your project's folder structure.

To use this wrapper follow these steps:
2. Drag-and-drop the whole `fliclib.xcframework` folder from your finder window to the `Frameworks, Libraries, and Embedded Content` section under
the `General` tab of your application's target setting.

Ensure that `fliclib.xcframework` is listed as *Embed & Sign*:

<img width="480" alt="Frameworks, Libraries and Embedded Content" src="https://user-images.githubusercontent.com/2717016/78569793-682a9b80-7824-11ea-98f9-ca0ee03ae0f3.png">

Doing this should automatically add the xcframework to `Link Binary With Libraries` under the Build Phases tab.

## Simulator Support

1. Include the files inside the `simulator-wrapper` folder to your project.
2. On all the places in your code where you need to import fliclib you should import the wrapper instead. In other words, replace `#import <fliclib/fliclib.h>` with `#import "fliclibWrapper.h"`. Of course, the file path will depend on how you have configured your project. For example, if you have the *fliclib-ios* repository as a git submodule in your project root then it might look like this `#import "../fliclib-ios/simulator-wrapper/fliclibWrapper.h"`.
3. Make sure that both `SCLFlicManagerSimulator.m` and `SCLFlicButtonSimulator.m` are added to *Compile Sources* in your project *Build Phases*.
The XCFramework bundle will run in the simulator by default, no configuration needed.

## Licence

Expand Down
Binary file removed fliclib.framework/fliclib
Binary file not shown.
41 changes: 41 additions & 0 deletions fliclib.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-armv7_arm64</string>
<key>LibraryPath</key>
<string>fliclib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>armv7</string>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-x86_64_i386-simulator</string>
<key>LibraryPath</key>
<string>fliclib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
<string>i386</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* @discussion Represents the diffrent connection states that a flic can be in at any given time.
*
*/
typedef NS_ENUM(NSInteger, SCLFlicButtonConnectionState) {
typedef NS_ENUM(NSInteger, SCLFlicButtonConnectionState)
{
/**
* The flic is currently connected. This means that the iOS device has an active link with the flic and that data can be sent in both
* directions provided that it has also been verified, notified by the <code>flicButtonIsReady:</code> callback.
Expand Down Expand Up @@ -44,7 +45,8 @@ typedef NS_ENUM(NSInteger, SCLFlicButtonConnectionState) {
* Please be mindful of battery usage.
*
*/
typedef NS_ENUM(NSInteger, SCLFlicButtonLEDIndicateCount) {
typedef NS_ENUM(NSInteger, SCLFlicButtonLEDIndicateCount)
{
/**
* The LED will fade 1 time.
*/
Expand Down Expand Up @@ -74,7 +76,8 @@ typedef NS_ENUM(NSInteger, SCLFlicButtonLEDIndicateCount) {
* The buttonUp and buttonDown events will be active no matter which of these alternatives you choose.
*
*/
typedef NS_ENUM(NSInteger, SCLFlicButtonTriggerBehavior) {
typedef NS_ENUM(NSInteger, SCLFlicButtonTriggerBehavior)
{
/**
* Used to distinguish between only click and hold.
* <br/><br/>
Expand Down Expand Up @@ -127,7 +130,8 @@ typedef NS_ENUM(NSInteger, SCLFlicButtonTriggerBehavior) {
* @discussion These enums represents the different error codes that can be sent on both the SCLFlicButton and SCLFlicManager classes.
*
*/
typedef NS_ENUM(NSInteger, SCLFlicError) {
typedef NS_ENUM(NSInteger, SCLFlicError)
{
/**
* An error has occurred.
*/
Expand Down Expand Up @@ -240,7 +244,8 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* using the specified delegate methods.
*
*/
@interface SCLFlicButton : NSObject {
@interface SCLFlicButton : NSObject
{

}

Expand All @@ -258,23 +263,23 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* @discussion The virtual ID of the flic.
*
*/
@property (readonly, nonatomic, strong, nonnull) NSUUID *buttonIdentifier;
@property(readonly, nonatomic, strong, nonnull) NSUUID *buttonIdentifier;

/*!
* @property buttonPublicKey
*
* @discussion The public key of the flic. This in the key that is used to identify the flic on our backend.
*
*/
@property (readonly, nonatomic, strong, nonnull) NSString *buttonPublicKey;
@property(readonly, nonatomic, strong, nonnull) NSString *buttonPublicKey;

/*!
* @property name
*
* @discussion The Bluetooth device name of the flic button.
*
*/
@property (atomic, readonly, strong, nonnull) NSString *name;
@property(atomic, readonly, strong, nonnull) NSString *name;

/*!
* @property color
Expand All @@ -283,23 +288,23 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* was already grabbed with an earlier version of fliclib, then the color will default to white.
*
*/
@property (atomic, readonly, strong, nonnull) UIColor *color;
@property(atomic, readonly, strong, nonnull) UIColor *color;

/*!
* @property userAssignedName
*
* @discussion This is the user assigned name of the Flic button that is assigned and displayed in the Flic App.
*
*/
@property (atomic, readonly, strong, nonnull) NSString *userAssignedName;
@property(atomic, readonly, strong, nonnull) NSString *userAssignedName;

/*!
* @property state
*
* @discussion The current state of the flic.
*
*/
@property (atomic, readonly) SCLFlicButtonConnectionState connectionState;
@property(atomic, readonly) SCLFlicButtonConnectionState connectionState;

/*!
* @property lowLatency
Expand All @@ -319,7 +324,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* Take a look at SCLFlicButtonTriggerBehavior to see the options available.
*
*/
@property (nonatomic, readwrite) SCLFlicButtonTriggerBehavior triggerBehavior;
@property(nonatomic, readwrite) SCLFlicButtonTriggerBehavior triggerBehavior;

/*!
* @property pressCount
Expand All @@ -333,15 +338,15 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* that anyone will ever reach those numbers. The presscounter will be reset if a factory reset is done on the physical flic button.
*
*/
@property (nonatomic, readonly) int pressCount;
@property(nonatomic, readonly) int pressCount;

/*!
* @property isReady
*
* @discussion This property lets you know wether the Flic is ready or not.
*
*/
@property (readonly) BOOL isReady;
@property(readonly) BOOL isReady;

/*!
* @method connect:
Expand All @@ -351,15 +356,15 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* pending connection. It can be canceled by calling the <code>disconnect</code> method.
*
*/
- (void) connect;
- (void)connect;

/*!
* @method disconnect:
*
* @discussion Disconnect a currently connected flic or cancel a pending connection.
*
*/
- (void) disconnect;
- (void)disconnect;

/*!
* @method indicateLED:
Expand All @@ -369,7 +374,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
*
* @param count Decides how many times the LED will indicate (fade)
*/
- (void) indicateLED: (SCLFlicButtonLEDIndicateCount) count;
- (void)indicateLED:(SCLFlicButtonLEDIndicateCount)count;

/*!
* @method readRSSI
Expand All @@ -379,7 +384,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* in decibels and has an effective range from -100 to 0.
*
*/
- (void) readRSSI;
- (void)readRSSI;

@end

Expand Down Expand Up @@ -408,7 +413,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* @discussion The flic registered a button down event.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didReceiveButtonDown:(BOOL) queued age: (NSInteger) age;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didReceiveButtonDown:(BOOL)queued age:(NSInteger)age;

/*!
* @method flicButton:didReceiveButtonUp:age:
Expand All @@ -422,7 +427,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* @discussion The flic registered a button up event.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didReceiveButtonUp:(BOOL) queued age: (NSInteger) age;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didReceiveButtonUp:(BOOL)queued age:(NSInteger)age;

/*!
* @method flicButton:didReceiveButtonClick:age:
Expand All @@ -437,7 +442,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didReceiveButtonClick:(BOOL) queued age: (NSInteger) age;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didReceiveButtonClick:(BOOL)queued age:(NSInteger)age;

/*!
* @method flicButton:didReceiveButtonDoubleClick:age:
Expand All @@ -452,7 +457,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didReceiveButtonDoubleClick:(BOOL) queued age: (NSInteger) age;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didReceiveButtonDoubleClick:(BOOL)queued age:(NSInteger)age;

/*!
* @method flicButton:didReceiveButtonHold:age:
Expand All @@ -467,7 +472,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didReceiveButtonHold:(BOOL) queued age: (NSInteger) age;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didReceiveButtonHold:(BOOL)queued age:(NSInteger)age;

/*!
* @method flicButtonDidConnect:
Expand All @@ -480,7 +485,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* after the <code>flicButtonIsReady:</code> callback has arrived.
*
*/
- (void) flicButtonDidConnect:(SCLFlicButton * _Nonnull) button;
- (void)flicButtonDidConnect:(SCLFlicButton * _Nonnull)button;

/*!
* @method flicButtonIsReady:
Expand All @@ -492,7 +497,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* immediately after the <code>flicButtonDidConnect:</code> event.
*
*/
- (void) flicButtonIsReady:(SCLFlicButton * _Nonnull) button;
- (void)flicButtonIsReady:(SCLFlicButton * _Nonnull)button;

/*!
* @method flicButton:didDisconnectWithError:
Expand All @@ -504,7 +509,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* This can sometimes be called during a connection event that failed before the user was notified of the connection.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didDisconnectWithError:(NSError * _Nullable) error;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didDisconnectWithError:(NSError * _Nullable)error;

/*!
* @method flicButton:didFailToConnectWithError:
Expand All @@ -519,7 +524,7 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* need to call the <code>connect:</code> yourself to activate the pending connection once again.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didFailToConnectWithError:(NSError * _Nullable) error;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didFailToConnectWithError:(NSError * _Nullable)error;

/*!
* @method flicButton:didUpdateRSSI:error:
Expand All @@ -532,6 +537,6 @@ typedef NS_ENUM(NSInteger, SCLFlicError) {
* @discussion This callback verifies (unless an error occurred) that the RSSI value was updated.
*
*/
- (void) flicButton:(SCLFlicButton * _Nonnull) button didUpdateRSSI:(NSNumber * _Nonnull) RSSI error:(NSError * _Nullable) error;
- (void)flicButton:(SCLFlicButton * _Nonnull)button didUpdateRSSI:(NSNumber * _Nonnull)RSSI error:(NSError * _Nullable)error;

@end
Loading

0 comments on commit b65a256

Please sign in to comment.