Comments (7)
The Swift 5 module template is updated as of last week. The iOS project is in a separate folder.
With this update, it is not allowed that your module depend on other CocoaPods. Because Swift Package Manager cannot build that. You still can have your example app depend on Pods.
I believe there is no special setup necessary at all. Just use CocoaPods on the example app. This would make it noteworthy. But no code would be needed in this repo to do it.
If that is correct I would be inclined to close this issue as resolved by the latest release.
from swift5-module-template.
Thank you for sharing. Minor note I see you are using Abc
, we are using Source
.
Your discussion relates to dependency management of your module (i.e. Pod) -- and you are managing external cocoapods dependencies using cocoapods.
It is also possible to consider dependency management of the test project. For example, the test program may use a UI testing framework. The test program depends on that, and your pod does not depend on that.
In terms of the recommended change to this project, are you suggesting that someone using swift3-module-template may run the configurator and then edit their vendored version of https://github.com/fulldecent/swift3-module-template/blob/master/__PROJECT_NAME__/__PROJECT_NAME__.podspec (and run pod update
) to add the dependencies they want?
from swift5-module-template.
@fulldecent Thank you for your feedback!
Abc
is __PROJECT_NAME__
in this example. I've moved the Source folder into the __PROJECT_NAME__
folder so that it better matches Xcode's default structure. I've updated my first post to give a bit more information on the folder structure.
The Podfile describes the pods used in the Abc
, AbcTests
and iOS Example
projects.
You can see in my example that the iOS Example
is only using the Abc
pod, but it is perfectly fine to add more pod references. Anything that you specify in the Podfile within a target will only be used by that target.
In terms of changes I recommend the following:
- Move the root
Source
into__PROJECT_NAME__
- Move the root
Resources
into__PROJECT_NAME__
- Create a folder
Resources
inTests
- Create a folder
Resources
iniOS Example
- Rename Tests to
__PROJECT_NAME__Tests
, e.g.Tests
becomesAbcTests
- Update the podspec template to match these changes
- Add a Podfile without dependencies to the root
- Run
pod install
after the configurator is done
To make it easier for the developer to keep the Podfile and the podspec in sync we could add a post-install script to the Podfile that rewrites the dependencies in the podspec.
I've also noticed a small issue that the date generated in the source files doesn't match the date format of my Xcode. Feb 9, 2017
should be 2/9/17
.
from swift5-module-template.
Thank you for the detailed recommendations and usable action plan!
Items 1, 2, 5, 6. Regarding folder names (Source/
folder, etc.), I am closely following the implementation of AlamoFire. This choice is also documented in the Recipe. If AlamoFire changes (and they are not shy about changing things) then I will follow their lead. Or if Swift Package Manager begins officially supporting iOS projects and has a conflicting folder layout, then I would adopt that. Xcode's default file layout should be respected, but at this time I trust AlamoFire more than Xcode in terms of project layout for a Swift module.
Items 3, 4. 👍 This is good and we should do it. I would like to find a decent example to add to this project. Because "hello world" is better than silence.
- Create a folder
Resources
inTests
- Add a resource to
Tests/Resources
and make a test case that uses it somehow - Create a folder
Resources
iniOS Example
- Add a resource to
iOS Example/Resources
and use it somehow in the example app
Items 7, 8. 👍 This introduces a dependency of this project onto CocoaPods. I want this project to support "any Swift 3 module that you want other people to include in their projects". Since not every Swift 3 module should be on CocoaPods then therefore this project should not depend on CocoaPods. Many people (myself included) WILL have CocoaPods installed and want to manage a dependency using CP. Therefore I am thinking:
- Edit the above Podspec
- Use file paths per this project
- Use actual existing pods instead of
Example
that people may want to use - Include one dependency for the iOS Example and one for the module
- Branch
master
intococoapods-for-dependencies
- Add the above podspec into https://github.com/fulldecent/swift3-module-template/tree/cocoapods-for-dependencies/__PROJECT_NAME__
- Update https://github.com/fulldecent/swift3-module-template/blob/cocoapods-for-dependencies/__PROJECT_NAME__/README.md to explain that you need to do
pod update
- Edit https://github.com/fulldecent/swift3-module-template/wiki/Using-CocoaPods-to-manage-your-module's-dependencies
- Add the Podspec above
- Update the wiki documentation for clear steps to follow
- Update to the checklist at the top of https://github.com/fulldecent/swift3-module-template/blob/master/__PROJECT_NAME__/README.md to mention and link to the above wiki
In doing these things, let's consider the pods that https://github.com/CocoaPods/pod-template uses by default. Because our cocoapods-for-dependencies
branch will be a candidate for replacing the pod-template
project. P.S. I am an editor on the pod-template
project.
from swift5-module-template.
I've used this template with pod dependencies, and my Podfile looks like this(without touching Project structure):
-----------------Podfile------------------
platform :ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
workspace 'PROJECT_NAME'
target 'iOS Example' do
project 'iOS Example/iOS Example'
pod 'PROJECT_NAME', :path => '.'
end
target 'PROJECT_NAME' do
project 'PROJECT_NAME'
&# dependencies here
target '__PROJECT_NAME__Tests'
end
from swift5-module-template.
Over time I've made a few changes, you can have a look at this project: https://github.com/Building42/Telegraph
The set-up works well and should be compatible with Swift Package Manager.
I'd like to integrate my framework without CocoaPods because it is sometimes really error-prone that you have to do a pod update
when you add files.
from swift5-module-template.
Closing for now. Please do comment or reopen if I have misinterpreted this.
from swift5-module-template.
Related Issues (20)
- Xcode 8.2.1 released, update recipe
- .travis.yml file has some issues. Also an issue with the location of info.plist for the test target. HOT 2
- __PROJECT_NAME__ not replaced in .gitignore HOT 1
- --PROJECT-NAME-- not substituted in PRODUCT_BUNDLE_IDENTIFIER
- Proj/Proj.xcodeproj/project.pbxproj has lines still with the term Proj.--PRODUCT-NAME--
- Adding ObjC file to template HOT 4
- Crash when using Swift standard libraries HOT 2
- Rename to swift4-module-template HOT 2
- Update for Swift 4
- Upgrade to support Swift 5 HOT 1
- Update ./configure for new variables
- Update Package.swift to use Swift 5+ HOT 3
- Update for Xcode Version 12.3 (12C33)
- No such Module $ModuleName in ContentView.swift (Xcode 12.4) HOT 3
- Unable to Drag and drop 'xxProjectxNamexx' in to iOS Example. HOT 2
- Move from Travis CI to GitHub Actions HOT 2
- Update recipe images HOT 3
- Support for Non-ASCII characters HOT 2
- Update for Xcode Version 14.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift5-module-template.