The design of the ONE SDK has three stages: Platfrom Layer, adaptation Layer, and core Porting Layer.

We use the platform layer -Platfrom Layer. Generally, in order to provide developers with different platforms and consistent API specifications with platforms, developers of different platforms can integrate SDK easily. For example, we will provide Java for Android, Objective-C for IOS and MAC, C++ for Linux and IOT platforms

On OS X, it is possible to create a Dynamically Linked framework. With dynamic wiring, the framework can be updated without application rewiring. At run time, a copy of the code in the library is shared and made available to the entire project, thus reducing memory consumption and improving system performance. This is a powerful feature. SDK in iOS project, commonly known as. A file. Create and use an SDK.

Environment: Xcode Version 8.1 (8T61a)

Operation:

  • Open Xcode, click File\New\Project, select iOS\Framework & Library\Cocoa Touch Static Library and create a New Static Library Project.

    Name the project StaticFrameBlueTooth(you need Bluetooth functionality and give it a Bluetooth name. If you want to go higher: XXXBlueToothSDK😀😀) and save the project to an empty directory.

    A static library project consists of header files and implementation files that will be compiled into the library itself. When creating a static library project, Xcode automatically add libStaticFrameBlueTooth. H and libStaticFrameBlueTooth. M. Because they don’t need to implement file, right-click the libStaticFrameBlueTooth. M choose delete, delete it.

  • 2. In fact, the current project is ready to use, but your library still need to add some features?? Create a StaticFrameBluetoot. a that you can use your own packaged controls. Drag your control from the Finder to the StaticFrameBlueTooth directory under Xcode. The objc folder is also dragged in, not !!!! when the project is created Take note !!!!)

    Be sure to check the following three boxes:

  • 3. Click Finish to enter the project:

    Compile Source is used during compilation, whereas Headers file only provides an interface! Add your control’s header file to the library’s main header file staticFrameBluetoot.h. With the help of the main header file, developers using your library only need to import a header file, as shown in the following code, to choose their own piece of import. You can also create Headers Headers and add Public, Private, or Project Headers to the Headers column. But the regulations should be clear, the framework should be clear!

  • 4. Next, generate the static library

    • 4.1 Static library is divided into mobile phone and simulator (only mobile phone can call, only simulator can call).

    First, build the static library of the simulator, as shown in the figure below: Building engineering (command + B), you’ll find libStaticFrameBlueTooth. A darkened.

    • 4.2 Then Show in Finder

    • After 4.3 I got the. A file, the StaticFrameBluetooth. h file and all his related. H files in a new folder (name it whatever!!). As follows:

  • 5. Drag it to the project you want to use, and you can splurge.

If you already know how to import the corresponding header file, you can use the third-party library or your own custom controls. You don’t need to know about my Demo examples! You can skip the introduction to the “Effects” picture. Look directly at the last mentioned real machine, simulator general SDK static library introduction!

Final operation result:

Put the beauty, is for the sake of beauty! 😀 😀 😀 😀 😀

Stop being distracted! See the segment! Let me explain the multi-section selector! Control is a variable length, but at least the width of the screen (showing 50 points in time: a multiple of 5). Passing in the time array automatically generates a multi-segment selector of suitable length. Of course the width is larger than the screen width. You need to put it in UIScrollView!

Because it sets its frame (20,200,105,30). The width is not the total length of time displayed (⭐️ background color ⭐️ is the best proof). Places beyond the width of the control cannot respond ⭐️ click on the event ⭐️ is also a verification!!

Generic static library

As mentioned above, the static library from simulator debugging can only run on the simulator. If you use the real machine, you must select the static library file (.a file) that can be called by the real machine. Next, we have to generate a both of us can use libStaticFrameBlueTooth. A first, open a terminal, copy the following command

lipo-create / Users/personal PC/Library/Developer/Xcode/DerivedData/StaticFrameBlueTooth - adahgwpnjulylkcjpaomvnxafgmq/Build/Products/Debug - I phoneos/libStaticFrameBlueTooth.a / Users/personal PC/Library/Developer/Xcode/DerivedData/StaticFrameBlueTooth - adahgwpnjulylkcjpaomvnxafgmq/Build/Products/Debug - I phonesimulator/libStaticFrameBlueTooth.aCopy the code

Description:

Green: is your cell phone mode available libStaticFrameBlueTooth. A red: is available when you simulator libStaticFrameBlueTooth. A blue: Is the last generation on both sides of the available libStaticFrameBlueTooth. A - and exists on the desktop. Finally get to libStaticFrameBlueTooth. A it can be used anywhere!Copy the code

(2016.12.01)

goyohol’s essay