I've got an existing Swift project in Xcode and I want to use the functionality of this github project (MangoKitten)
They suggest using Swift Package Manager but when I tried setting up that my Xcode went haywire and would crash every time I tried launching it.
So I've finally managed to undo the damage done from SPM and am trying to just go ahead and add MangoKitten into my project manually so that I can use the functionality it provides with a simple import statement in my viewController.swift
I've never used Github before and I'm relatively new to Swift in general so this is all very confusing.
Is there any simple way to import the github project into my Xcode project without downloading it and adding every single .swift file manually into my project?
Thanks guys.
Related
I have a Demo project and Framework which can be integrated with multiple ways(Cocoapods, SPM - using generated XCFramework, directly integrate with XCFramework)
For distributing Demo app to external users we integrate the Framework with SPM.
Problem with this approch is during development its makes really hard to regenerate XCFramework after each change, so I have decided to drag and drop the Framework's project to Demo app, but cant understand how to recompile XCFramework if there is a change.
Could you please help me with understading how to handle this scenario.
Create an .xcworkspace that contains the framework project and the demo app project side by side, then inside the demo app target General settings (see screenshot), add the .framework file from the framework project within the workspace instead of depending on the .xcframework binary file directly.
After that, add a "Copy File" build phase that embeds the framework file.
I'm currently refactoring my Xcode project into a Swift Package with multiple modules, which I combine with a lightweight Xcode project using an XCWorkspace (kind of like Pointfree's isowords). Right now, my Xcode project is hosted on a GitHub repo. However, with this refactoring, it's the Swift Package which will be hosted on GitHub.
Can I replace my Xcode project with the Swift Package on the repo, without losing all my history? Will the history of files inside my Xcode project still show up?
Yes, this will be fine. Even if you delete every single file in your git repository and push it, your entire commit history will still be there. Feel free to replace your project with a package!
I have an existing project which uses Cocoapods, but I would like to switch to SPM; unfortunately I still have dependencies which aren't available in SPM.
Now I would like to move as many dependencies as possible over to SPM and keep the others in Cocoapods as long as necessary - is this possible? Having both, Cocoapods and SPM?
I just tried CocoaPods with SPM on my iOS project and it works fine.
I'm adding Firebase and other Google libs using CocoaPods and the rest using Swift Package Manager.
When adding SPM dependency, put checkmark on your project(s) and not on the Pods project.
Xcode 11.5,
CocoaPods 1.9.3.
After trying it out I found you can actually have a SPM + Cocoapods to play nice. You install your SPM library on the .xcodeproj while you develop on the .xcworkspace. It all works (at least so far for me lol).
If you are using CI, or you launch manually from xcodebuild command some tweaks with the -clonedSourcePackagesDirPath flag
I have had used swift package manager at the beginning and added 4 packages in my project. When I had to integrate admob sdk. I added cocoapod to my project.
but after open the .xcworkspace file. the packages status are display as Missing. I have to add them from SPM one by one. after all 4 packages were added again. the project can be built and executed again.
Considering all the pros and cons, I found it suitable to use CocoaPods as SPM is still at a very nascent stage and not all libraries support it.
Please go through the blog written by Darshan Patel by https://blog.kiprosh.com/preferable-dependency-manager-swift-package-manager-spm-or-cocoapods/ for more details.
I am developing the main app and a library (open source, forked but will go back into main repository) used by the app at the same time. I want to use Swift Package Manager and Xcode at the same time. What is the best setup in order to use the best of both worlds? Can I develop both in one workspace?
I'll describe the approach I've used before. I'm assuming you have the Swift Package available as source code in a folder, e.g. cloned using Git.
Open your main app project
Drag the root folder of the Swift Package onto your Xcode project
Open the project overview, select your app target, and under "Frameworks, Libraries, and Embedded Content", add your library
Import the library in any Swift file where you depend on it
This will resolve and fetch all dependencies and still allow you to change source code in the library on the fly if you need to.
It's clear how to add an existing project to GitHub outside of Xcode, there are a number of tutorial: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
There are also a number of tutorial of how to create a new project in Xcode under version control.
However, there are no tutorial on how to do both: add an existing project with the controls within Xcode. Is this even possible? Or since I already started the project, I'll have to do it all via command line?
Since you didn't ask Xcode for a local git repository inside this project folder when you created the project, you will have to create one via the command line.
After that, you can use Xcode's internal GUI to give git commands in your project - if that's the kind of thing you really want to do (personally I abhor Xcode's git interface).