Goals & Deliverables: 1. Create a cocoa pod library that exposes 1 public Swift function…
Private research annotation
Sign in to add a private research label or note.
- User
Goals & Deliverables:
- Create a cocoa pod library that exposes 1 public Swift function interface:
Func doubleThisArray(array: [Float]) -> [Float]
The output of this function should be doubling the element of each array and returning the new doubled array.
- The implementation of this function should NOT be done in Swift though and should be delegated to a C function in a file that you create.
The C header file should contain a function which the implementation of the swift function
doubleThisArraywould call, double the array in C and return back to Swift’sdoubleThisArray.doubleThisArrayswift function would then convert the return value of the C function back to a Swift array and return this to the caller ofdoubleThisArrayThe implementation of
doubleThisArraywill look roughly like this:codeFunc doubleThisArray(array: [Float]) -> [Float] { // TODO: Call C function and pass `array` to it to double the output // TODO: Convert the return value of the C function to a Swift array // TODO: Return the new swift array to the caller // TODO: Make sure there are no memory leaks }-
Create a unit test for this function:
-
Upload this library to Github for NimbleEdge to inspect your code.
-
Release this library in a private cocoa pod and give access to NimbleEdge team to install and test on a new iOS project.
- Assistant
- User
where is my .podspecfile?
- Assistant
Your
.podspecfile should be located in the root directory of your CocoaPod library. If you followed the instructions in the previous response, you should have created a.podspecfile namedMyCocoaPodLibrary.podspecin theMyCocoaPodLibraryfolder.To ensure the file is in the correct location, navigate to the
MyCocoaPodLibraryfolder using the Terminal and then list the contents of the folder:shcd MyCocoaPodLibrary lsIf the
.podspecfile is missing, create it using the following command:shtouch MyCocoaPodLibrary.podspecNow you can open the
.podspecfile and add the necessary information as described in the previous response. - User
show me MyCocoaPodLibrary.podspec
- Assistant
Here is a sample
MyCocoaPodLibrary.podspecfile for your library. ReplaceYOUR_GITHUB_USERNAMEwith your actual GitHub username, and update the other fields as needed:ruby