Best way to include a demo project with a CocoaPod? - cocoapods

I am wondering what is the best way to include a demo project with a CocoaPod. In particular, I want this to a be a component that anyone can try using the pod try command.
I see two options:
option 1: embedded project in Examples/ with a Podfile
Here the Pod contains an embedded project, which uses a Podfile to reference the pod itself.
This is what is suggested by the directory structure produced via the pod lib create command, and by the CocoaPods documentation.
option 2: embedded project in Demo/ using pod as a resource
Here the Pod contains an embedded project, where the Xcode project file uses a relative path to refer directly to resources from the pod itself.
This is what I see in various examples in the wild, and it is what is working right now in a Pod I am authoring.
As CocoaPods is still in flux, I am wondering if one way is more "blessed" than the other. Is the documentation suggesting option 1 out of date? Or is the code supporting option 2 out of date? Will both work with pod try going forward?

Please, see as also this answer where demo project search heuristics are explained.
The best solution is to look through the def pick_demo_project(dir) routine in the try-plugin source https://github.com/CocoaPods/cocoapods-try/blob/master/lib/pod/command/try.rb#L133 to see the actual demo choosing options.

Related

framework not found FirebaseInstanceID in Xcode

Step to reproduce.
I have added all the pod frameworks into my cordova project using XCode, after added, I don't know why the frameworks are whiten as this picture.
So I start to build the project again, the first error said framework not found FirebaseInstallation, I thought the whiten framework is not valid, so I manually add the framework from my frameworks folder which is downloaded from https://firebase.google.com/docs/ios/setup#frameworks and finally become the normal yellow icon.
I rebuild the project, this time the error is framework not found FirebaseCoreDiagnostics. Therefore, I repeat step 2 to add in the framework manually and compile again.
This time the error is also framework not found but it is FirebaseInstanceID. As you can see from my Pods folder above, there is no FirebaseInstanceID framework that I can manually add into my project. I have search online, there is no single file named FirebaseInstanceID.framework exist on the internet. Where can I download it actually?
Furthermore, is it the right way to manually add in all the pod frameworks into my project to solve the error? How can solve this kind of framework not found issue in Xcode? Thanks for any comment.
FirebaseInstanceID.framework is available in several of the folders from the download https://firebase.google.com/docs/ios/setup#frameworks, including FirebaseMessaging.

No such module `Toaster`

I am getting a No such module Toaster. I have installed the pod, also after searching on SO, I fixed the red Pod_Project.Framework issue. Now its gray. I also verified Framework Search Path's and ensured that the Pod in question is recursive.
I have read thru this and this. Ideally I expected that things should have worked by default, just install the Pod and import and it should work. Is this expectation incorrect ? Should I need to change settings everytime I install a pod ?
EDIT 1
Also added Toaster pod to the Framework Search Path
Still the same No such module error on the import.
EDIT 2
I tried opening the .xcworkspace. But same issue again.
#siddharth as you mention above is correct. But Linked FrameWorks and Libraries are not in build Settings. It is In Build Phases

XCode 8.2.1 error - No such module YouTubePlayer

I am using https://github.com/gilesvangruisen/Swift-YouTube-Player
First I've tried to import it manually from everywhere include dropping, copyng, embed framewordks, embedded binaries, linked frameworks, but it was unsuccessfully with error message No such module YouTubePlayer
Next I used cocoapods. Install it and run it from .xcworkspace. Then try to run it and again error message No such module YoutubePlayer
This is list tree directories after pod install
Maybe this is the solution, but I don't know where is repo and how to do the described action.
https://github.com/gilesvangruisen/Swift-YouTube-Player/issues/42
The reason why its failing with cocoapod is because the pod written is in old swift version. So, unless until we don't compile the pod successfully, we can't import that. You can change the old swift code to new using :
Xcode->Edit->Convert->To Current Swift Syntax
Also you can use the latest release and build the framework from the repo you mentioned:
https://github.com/gilesvangruisen/Swift-YouTube-Player
I downloaded the latest release and created the youTubePlayer framework and linked it to a sample app and able to import it.
Please check this link for the sample app which is having YouTubePlayer framework as well which you can use in your own project.

How to remove my created pod specifications

I've created a pod specification for learning, and now I'd like to remove it as it is shown under my name when searching for pods. I've looked everywhere in the documentation and couldn't find how to do it.
CocoaPods doesn't support pod deletions, you should release a new version with the deprecated flag set. We're working on figuring out how to support deletions, but it's a long process and we want to ensure it's right.

Create Xcode Project with Ruby XcodeProj

I had this idea of making a command line utility similar to the rails setup application.
It should automatically create a Xcode project, setup unit test, setup Frank, install most used Cocoapods and setup a project structure.
There is no such thing at the moment and I would really like to have it and open source it.
I struggled around the other questions here yesterday but found nothing up to date.
I came up with the idea using XcodeProj which is used by CocoaPods to generate a project containing the Pods. So it should not be impossible to do. I also found XcodeProject but this seems to be read-only.
Can someone (maybe of the Cocoapods developers) give me a hint where to start, because the Xcodeproj gem is very undocumented.
To the best place to start to use Xcodeproj is the Xcodeproj::Project class.
Once you open a project the Xcodeproj API allows to edit all the known attributes easily. However you need to keep in mind the following concepts:
If an attribute is a String you can edit it directly.
If an attribute stores an object it is necessary to ask the project to create a new one so it is has the chance to assign an UUID.
If you are editing an attribute which stores a list of objects it is safe only to use the method exposed by the ObjectList.
Xcodeproj performs type checking when you assign values to attributes.
The following lightly tested code should help to get you started by creating a new project named Test with a target named App for a deployment target of iOS 6.0 that adds Class.h and Class.m file to the project, ensuring Class.m is included in the target.
require 'xcodeproj'
proj = Xcodeproj::Project.new
app_target = proj.new_target(:application, 'App', :ios, '6.0')
header_ref = proj.main_group.new_file('./Class.h')
implm_ref = proj.main_group.new_file('./Class.m')
app_target.add_file_references([implm_ref])
proj.save_as('Test.xcodeproj')
Please let us know, opening an issue, which parts of the documentation you find confusing. For more karma use a pull request.

Resources