How to install XCGLogger? - swift

I want to add the XCGLogger Framework to my project.
At the XCGLogger github page is a "how to use"-section and a also a demo project. Some tasks are not quite clear for me. Therefore some questions:
"Add the XCGLogger project as a subproject to your project" - Does it mean to simply drag the "Library"-Folder into to my project folder in the project navigator?
"and add either the iOS library as a dependancy of your target(s)" - How am I doing that?
What do I have to do at the Product->Scheme->Edit Scheme ... Menu? Because I don't want the framework in my release build.

Related

Add a local Swift Package target to an existing Xcode project

I have an existing Xcode project that contains targets for a "traditional" iOS app ("Foo") and an iOS framework ("FooLib"). When the Xcode 12 beta dropped a few days ago, I added a multiplatform (iOS/macOS) SwiftUI app target ("Foo SwiftUI") to the same project. Now I want to make my framework cross-platform, too, so I added a multiplatform Swift Package ("Foo Package") to the project and moved the iOS framework classes to the new Swift package. I then added this package to all app targets' Frameworks, Libraries, and Embedded Content sections. It appeared to work for all app targets until I cleaned the project and tried again. Now the app targets complain that the Foo Package can't be resolved:
Missing package project 'FooLib'.
I tried removing & re-adding the FooLib package to the app targets, but it no longer shows up in the pop-up list of frameworks and libraries to add. Are local Swift packages explicitly unsupported in Xcode projects? Do I need to put the package in its own Git repo and set it up like any other third-party package dependency?
What I'm most confused about it that it looks like it worked right after I created the Swift package, but not after I cleaned the project and tried re-running the app targets.
OK, sorry for my previous answer. — It is obvious how to share a package with yourself by way of a remote URL, such as GitHub, that serves it. Basically you are playing the role of both developer and end-user, and it's clear how to do that. So I think what's needed here is a step-by-step tutorial to sharing a package with yourself locally without actually serving it.
In Xcode, choose File > New > Swift Package and save as MyLibrary to the Desktop.
Now choose File > New > Project, choose the iOS App template, and save as App1 to the Desktop.
You now have two windows open. Drag MyLibrary from the project navigator in the MyLibrary window into the empty area at the bottom of the project navigator in the App1 window.
Quit Xcode.
Launch Xcode again and open App1. Look, the MyLibrary icon now has hierarchical contents. Edit the app target and add MyLibrary library as a dependency.
You can now edit MyLibrary; you can also import MyLibrary in your code and you will be able to use any public members of public types.
Close App1 and create another project, App2. Repeat steps 3, 4, 5, and 6.
From now on, either App1 and App2 can "see" MyLibrary. From either one, you can edit MyLibrary, you can import it and use its code. But you cannot have both App1 and App2 open at the same time. If you do, one of them will complain that the package is missing. So you'll be fine as long as you only have one at a time open.
Now, if you want to escape that limitation, then go back to the first way of dealing with all this: upload the package to GitHub and acquire it in your projects as a package dependency.
For me, it works using Xcode Workspaces “around” local Projects and Swift Packages.
Create App project
Create Swift Package
Create Workspace for app project
Add the App project to the Workspace
Add the Swift Package to the Workspace, too
In the app target “General” settings, “embed&sign” the Swift Package from the current workspace
You might have to restart Xcode afterwards for it to pick up on the changes ...

Link a binary framework to both Pod Target and main app project

I have a library project which was installed via Pod into my main project. That library project use a framework. I didn't or actually couldn't embed that framework in the library project cause of making Umbrella Project and this is not recommended by Apple.
So I tried to embed it in my main project but the library project in Pod couldn't see it so that lead to error "No such module"
So how I can link the framework which embedded in the main project to that library pod target.
Ok. I'm able to make it work. Just drag the folder on main project which contain the framework in your pod target project framework search path. It will automatically transform a path like this
"$(SRCROOT)/../"

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

Create NuGet package for an entire solution

I'm trying to create a nuget package that contains my "starter project". This is a project which I use to start every Umbraco project.
This starter project has the following structure:
Solution:
Umbraco project
CustomControls project
In short, I want Nuget to:
1) download a specific version of Umbraco, and put it in the Umbraco project folder
2) Add the CustomControls project
I can put the CustomControls project in the "Content"-folder, but I can't get the Umbraco project in my solution at the top level. Right now, NuGet seems to create this:
Solution:
Umbraco project => CustomControls project
So the CustomControls project is inside the Umbraco project, which doesn't serve my purpose as it has to remain separate.
So two seperate projects inside one solution.
How do I go about this?
One of the parameters in Install.ps1 is called $project, and it is a reference to the EnvDTE Project object for the project into which your package has been installed. You should be able to call DTE.Solution.AddFromFile() to add another project to the solution.

How to add Sharekit to existing project

How to add sharekit to existing project for sharing on social networks.
Following instructions from sharekit wiki.
If i add sharekit.xcodeproj to my project i see only one target in share kit but in sharekit wiki it shows four targets.
When trying to add ShareKit's targets as depenedencies to your project's build phase: your project's app target - build phases - target dependencies add 2 new targets from ShareKit subproject: "Static Library" and "Resource Bundle". I dont find any static library and resource bundle.
Please help how to add sharekit in project.
what i did to find these targets ;
Right click on your your project navigator in xCode, then choose Add files to ...
then choose submodules in your project folder and add.
After that you will find "Static Library" and "Resource Bundle" in targets dependencies.