Open sssilver opened 7 years ago
Hi @sssilver,
This is intended behavior. As you can see in your output logs Putting demo application back in, you cannot do view tests without a host application.
If you don't want an example application you can't have view based testing as those require a host application.
Best, Julian
Hmm, when view tests are turned off, the behavior is the same. It still creates an Example
directory, even when no example project is requested.
I also don't understand the directory structure. Every CocoaPod repo on GitHub has a .xcodeproj file in the root directory for editing and building source files. Where did this come from?
The .xcodeproj
is used for development by the developer. It can also be used if you decide not to use CocoaPods and just clone the repo as a submodule (or copy paste the contents) and then drag the .xcodeproj
manually into your project.
The .podspec
basically represents the same sources as the .xcodeproj
but for CocoaPods. A lot of issues often arise due to this inconsistency and generally it would be great if the .xcodeproj
is just generated by the .podspec
instead.
...or by pod lib create
!
has anyone found a solution to this yet ?
TL;DR :
I only see the framework scheme (so no app target), so other than the name of the folder being example
(and it not being too descriptive) I see no issues. If you add view based testing it'll add back the app target because it's required for view testing.
Let us know if there's still an issue. Otherwise we'll close this in a couple of days.
Long version:
@inderdeep25 For this input:
pod lib create MyLib
Cloning `https://github.com/CocoaPods/pod-template.git` into `MyLib`.
Configuring MyLib template.
------------------------------
To get you started we need to ask a few questions, this should only take a minute.
If this is your first time we recommend running through with the guide:
- http://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and click links to open in a browser. )
What language do you want to use?? [ Swift / ObjC ]
>
swift
Would you like to include a demo application with your library? [ Yes / No ]
> no
Which testing frameworks will you use? [ Quick / None ]
>
quick
Would you like to do view based testing? [ Yes / No ]
> no
Running pod install on your new library.
Analyzing dependencies
Fetching podspec for `MyLib` from `../`
Downloading dependencies
Installing MyLib (0.1.0)
Installing Nimble (7.0.3)
Installing Quick (1.2.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `MyLib.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.
[!] Automatically assigning platform ios with version 9.3 on target MyLib_Tests because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Ace! you're ready to go!
We will start you off by opening your project in Xcode
open 'MyLib/Example/MyLib.xcworkspace'
To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`.
I am getting this directory structure:
tree -L 3
.
└── MyLib
├── Example
│ ├── MyLib.xcodeproj
│ ├── MyLib.xcworkspace
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Pods
│ └── Tests
├── LICENSE
├── MyLib
│ ├── Assets
│ └── Classes
├── MyLib.podspec
├── README.md
└── _Pods.xcodeproj -> Example/Pods/Pods.xcodeproj
And when opening the project, I only see the framework scheme (so no app target), so other than the name of the folder being example
(and it not being too descriptive) I see no issues.
@jugutier, But isn't the MyLib.xcodeproj
in the Example
folder used as a demo application?
I'm struggling with this as well.
so other than the name of the folder being
example
(and it not being too descriptive) I see no issues.
Well it causes some confusion 😅
2 xcode projects are generated and a workspace that combine the 2 projects.
MyLib
├── Example
│ ├── MyLib.xcodeproj
│ ├── MyLib.xcworkspace
│ ├── Pods
│ │ ├── Pods.xcodeproj
... ... ...
So the workspace should be used for development? Sources of your pod can be found in the Pods.xcodeproj
in Development Pods/MyLib
? And tests in the other project in the workspace: MyLib.xcodeproj
in Tests
:
But then again:
I’ll take another look at this tonight. Are you entering the same input to the interactive menu? @teameh
Thanks for the quick reply! \0/
Yes:
$ pod lib create MyLib
Cloning `https://github.com/CocoaPods/pod-template.git` into `MyLib`.
Configuring MyLib template.
------------------------------
To get you started we need to ask a few questions, this should only take a minute.
If this is your first time we recommend running through with the guide:
- https://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and click links to open in a browser. )
What platform do you want to use?? [ iOS / macOS ]
> iOS
What language do you want to use?? [ Swift / ObjC ]
> Swift
Would you like to include a demo application with your library? [ Yes / No ]
> No
Which testing frameworks will you use? [ Quick / None ]
> None
Would you like to do view based testing? [ Yes / No ]
> No
Running pod install on your new library.
Analyzing dependencies
Fetching podspec for `MyLib` from `../`
Downloading dependencies
Installing MyLib (0.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `MyLib.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `ios` with version `9.3` on target `MyLib_Tests` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Ace! you're ready to go!
We will start you off by opening your project in Xcode
open 'MyLib/Example/MyLib.xcworkspace'
To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`.
Hi @teameh
Sorry for the delay.
We'll change the folder name to something other than example (at least for this configuration) I think it definitely is confusing for that setup.
In the meantime yes, use the xcworkspace to develop and run pod install periodically in the test framework to make sure your podspec includes every file & asset the way you want.
Essentially MyLib.xcodeproj
is a test framework target to which you pod install
your local development pod. the xcworkspace holds both together so you can test and run the code as you develop it.
Let me know if that makes sense 👍
Yeah I think that makes sense. 👍
And maybe this is a bit off-topic... but I think it would also be nice if the pod lib create
cli would (also) provide an option to scaffold a project with a fixed xcode project instead of a xcode project that is generated when you pod install
the example app. I ran into a problem with creating a pod that required a build script to be ran during development (and not when compiled in users' app's). But if I add it to the generated xcode project it's gone every time I run pod install
. It probably makes sense for most users to have this generated approach. but not for everyone.
Hi @jugutier
Any idea when the changes discussed with @teameh above will be implemented? As of Cocoapods version 1.5.3, the behavior above is still the same, and I can concur that it's really confusing.
Also, as an addition, when an example project is specified in the questionnaire presented by pod lib create
, can there be two separate directory trees for both the example project and the actual pod? For example, something like below...
MyLib ├── MyLib.xcworkspace ├── Example │ ├── MyLib.xcodeproj ├── MyLib │ │ ├── Pods.xcodeproj │ │ ├── Assets │ │ ├── Classes
I never really understood why the Xcode workspace is within the 'Example' directory when it contains both the pod and example(if one is specified) projects.
No time frame I'm afraid, CocoaPods is just something people work on in their spare time - if you'd to see the change, you're welcome to take a look at shipping a PR 👍
$ pod lib create
always creates a directory called Example and puts the workspace in it, even when asked not to create an example project.Even if functionally this makes sense (a library needs a workspace to be opened in Xcode and worked on), semantically in this case the name "Example" is a nonsense.
Creating a library without an example
What the directory tree looks like
CocoaPods Environment
Installation Source
Plugins