Pure swift framework without giving the source code/xcodeproject - ios

I have been following framework making tutorials for building my frameworks and one thing I noticed that after building the framework, the example states to use the .Xcodeproject along with other codes needs to be referenced to the example project to use the framework, that should not happen, if so happened, what is the need of the framework as there will be no security of the code?
can anyone throw some light on this to resolve the doubt?

Related

Confusion about swift framework build processes

Im currently working on a Swift Framework using OpenCV (3.4.3), and im having some troubles or getting confused about how the build processes work.
Note I'm not using CocoaPods, Im using the framework file/folder provided by OpenCV
So my problem is that I'm creating the swift framework that depends on OpenCV, once I've built my framework and add/link it to a App (Its added to the embedded frameworks section), the app runs fine with no errors. This is where my confusion lies, I would expect to also add OpenCV to my app then have them link at runtime/compile time, but that's not the case OpenCV is magically linked and working. I have also double, triple checked that there is no references of OpenCV in the app to ensure its not getting pulled in anywhere.
For some sanity checks I created a basic framework called TestFramework, which had 1 class, with a static function just so I can test the above process. I added TestFramework to the main framework im working on, and built it. I then added that Framework to my app, and it would not build because the TestFramework was not present in the App as a dependency. Then adding the framework allowed it to build, and the main framework then was able to call the code within the TestFramework.
There seems to be some discrepancy between how the two work, unless the OpenCV framework is built in a different way allowing it to work without the app depending on it.
Any help or thoughts would be great, thanks.

Using a modified PDFTron Tools Framework

I'm working on a iOS Framework (using CocoaPods) that, as of today, uses PDFNet.framework as its only dependency.
Everything works as expected when I use the resulting framework in another "top level" project.
Now I'm trying to make this same Framework use the Tools.framework, as I intend to use the annotations from the Tools library.
Is there a common approach in doing so?
I've tried building the Tools source code but it fails as the dependency isn't found.
Everything you need should be in the following guide.
https://blog.pdftron.com/2016/11/14/getting-started-with-pdfnet-for-ios/
If that guide does not help, then please answer my comment above.

Basic Mechanics of iOS Frameworks and Xcode (and Swift)

I think I just must be stupid.
I'm having a lot trouble understanding very basic things concerning frameworks in Xcode/iOs/Swift. While I've certainly gotten some things to work, I've gotten more and more confused about what I'm actually doing. And the documentation on the web just confuses me more.
When I see discussions about how to import particular frameworks (e.g. https://github.com/danielgindi/Charts is the library I'm playing with, but I've seen this pattern repeated in other libraries) they seem to always tell me include the Xcode project file as a child project of my project, in addition to linking things as an embedded binary. This confuses me. Is it not possible to link an already compiled framework to my project without including all the source code of the project?
That is, can't I just take a library.framework file, and add it to my embedded libraries list and be done with it?
In the frameworks I've played with (again https://github.com/danielgindi/Charts is my primary example, but this is true in many others I've played with) I can't seem to use the framework without Carthage or CocoaPods. For me at this stage, that is just confusing... I accept that they are useful tools to automate a difficult process, but I'd really like to understand what that process actually is before I let a tool automate it for me. As I search the web I just seem to always be led back to these tools as being the correct way to do things.
So here are my questions.
If I find a framework library on the web... do I need its source code or can I somehow just link to a compiled version of the framework?
In my reading, it seems that libraries made with Swift are somehow second-class citizens because Swift is a newer thing. Is that still the case? (The articles I read about this seems to date from 2014-2015).
Is there are good place to understand how Apple expects me to add a framework to a project, without using CocoaPods or Carthage?
No need to add source code. Just add the framework to Target ->
General -> Linked Framework and Libraries -> Tap on + and select
your framework.
In my opinion, many new libraries are being written is Swift. So you won't be left behind for using swift.
Apple has documentation about adding frameworks to XCode. But I would suggest to use Cocoapods , as its easy to manage libraries.
Cheers :)

How to create framework with other frameworks and library dependency?

I know, there are so many same questions but I didn't get answer for my requirement.
First time I am creating framework. I have created test framework using Raywenderlich example. But my requirement is little bit different. I used so many different frameworks and also used SQLCipher in my project. Now, I want to convert this project into framework. I followed all the steps but the problem is occur when I am trying to build. Getting an error for SQLCypher because I didn’t add to my framework to avoid conflicts. Finally, I have added SQLCypher library to create build without error and it worked but now I am getting linker error when I am using that framework to test in testProject. I didn’t find any example with third parties. Please help me to solve this issue.
I had the same issue.
One solution is to change all method names of other frameworks or libs, but some lib is not open source.
Another solution is work for me which is to use cocoapods. But the user
who wants to use your framework will be forced using cocoapods, depending iOS 8.0 or above, depending the same version of 3rd libs. I have nothing to do with this restriction.
Seems the best way is do not depend 3rd libs in a framework.

Would adding Parse to an IOS Framework cause issues?

If I am building a Framework that depends on Parse, would this cause issues for apps already using Parse and would like to use my framework? More specifically, if I initialize my Parse app in the framework, and then the app using this framework initializes Parse again, would they interfere?
Yes, they will and that's the reason CocoaPods exist, to ease the pain of dependency of frameworks.
Framework must not depend on another framework is the bottom line. If you do , it will leads to collisions, if the other framework also includes that framework.
I would suggest you to learn CocoaPods. The dependency problems will find the solution.

Resources