Adding a NSPersistentContainer in a existing project - iphone

How do I add a NSPersistentContainer in a existing project in xcode?

Related

Xcode have 2 projects under 1 workspace

I have 1 workspace with project with project with swift3.
Now I need to add other project or target. I am not sure.
But the goal is to have the other project in swift4. It will be helper project for main project in swift3. And this second project should be available from swift3. It's extensions for UIViewController. How can I make it?
You can do that either as separate project or as target of existing project.
Create Framework
Choose Swift version(4.0 in your case)
Add Swift file
Link framework in application
Import framework and use extension

xcode : adding external framework

I have a .framework (external framework) file that was created by xcode 9.2 with deployment target 9.0. I wanted to link this framework with my project. I linked the framework in embeded binaries and frameworks and libraries. There was no error with that but my application not being opened.
Thanks in advance.
There is a duplicate appdelegate in the given external framework. SO that when we add it to the current project, Appdelegate of the current project not called.
So make sure the external framework not having duplicate Appdelegate.
Thanks

iOS framework resource files

I have created a framework with bundle files. Bundle files are under resource folder inside the framework. So my problem was whenever someone need to integrate the framework in their project then they have to drag and drop the bundle file from framework resource folder to project. Is possible to programmatically link the framework resource file and read it inside the project?
To include the resource bundle, select the target of your framework, and in the Build Phases > Copy bundle resources, click on the + button and add any resource bundle which you wish to have packaged into your framework.
When you build the framework, the resource will be copied. Make sure that this file exists though or you'll get a build error.
If you go in "Edit Schemes" for your framework project, in the "Build" section, you can add the resource file, so that when you will build the framework, it will also rebuild the resource bundle.

Using Alamofire within a Playground

I'm new to iOS development and using Xcode and I'm having trouble getting Alamofire to work within a Playground. There's some functionality I'd like to test out for proof of concept but the library is not linked to the Playground and I've tried getting it to play nicely. I have Alamofire set up to work within an iOS (not in a Playground) project before the installation instructions in the Github Alamofire repo were recently updated.
Any suggestions on how to get Alamofire to import properly in the Playground?
Apple provides excellent step-by-step instruction to do so here: Importing Custom Frameworks Into a Playground
Here is what I consider to be the simplest straight line path:
Download and build Alamofire:
brew install carthage
echo "github \"Alamofire/Alamofire\"" > Cartfile
carthage update
Configure the workspace with a playground file and Alamofire.
From the Carthage/Build/{iOS / OSX} directory, drag the Alamofire.framework file into your link library list: {Project Name} -> {Target Name} -> Build Phases -> Link Binary With Libraries
Command-N (create file) -> {Platform} -> Source -> Playground
If not already in a Workspace file, File -> Save as Workspace. To be paranoid, I close the project / workspace and (re)open the workspace.
Click on the playground file created in #2, and add the import import Alamofire
You can try moving library to
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/System/Library/Frameworks/
Then you can import and use it right in your playground
You can create a playground within the project also like in this tutorial
Steps
If the project is not in a workspace, save as workspace
Create new Playground, by adding to workspace level in the project pane
Ensure your project has a framework target. If it doesn't Edit the scheme to add a new Cocoa Touch Framework target (it doesn't need to have unit tests)
Add the files that you want to use in the playground, to the new framework target
Build the Framework by selecting the target in the build box at the top
In the playground, import the Framework. If the classes you want to use are not public, you need to import like so: #testable import ModuleFramework

Brakepoints in xcode subproject don't work

We have static lib project, and other "sample" project.
I added static lib project as a subproject to "sample" project and also to target dependancy.
When I run "sample" brakepoints work properly, but not in subproject (static lib).
Is it possible somehow to debug my subproject, or it's impossible if it's static lib?
UPDATED
Fixed:
For some reasons "Generate Debugging symbols" flag was set to NO
Create one workspace and put it as separate projects. Now You need to add static lib in sample project. So add library from sub project product folder (where your lib get created) as reference. It will work also for debugging and whenever you will build for static lib that changes will reflect in sample project also.