Giter Site home page Giter Site logo

Comments (7)

fulldecent avatar fulldecent commented on July 25, 2024 1

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.

fulldecent avatar fulldecent commented on July 25, 2024

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.

yvbeek avatar yvbeek commented on July 25, 2024

@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:

  1. Move the root Source into __PROJECT_NAME__
  2. Move the root Resources into __PROJECT_NAME__
  3. Create a folder Resources in Tests
  4. Create a folder Resources in iOS Example
  5. Rename Tests to __PROJECT_NAME__Tests, e.g. Tests becomes AbcTests
  6. Update the podspec template to match these changes
  7. Add a Podfile without dependencies to the root
  8. 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.

fulldecent avatar fulldecent commented on July 25, 2024

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 in Tests
  • Add a resource to Tests/Resources and make a test case that uses it somehow
  • Create a folder Resources in iOS 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:

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.

dm-z avatar dm-z commented on July 25, 2024

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.

yvbeek avatar yvbeek commented on July 25, 2024

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.

fulldecent avatar fulldecent commented on July 25, 2024

Closing for now. Please do comment or reopen if I have misinterpreted this.

from swift5-module-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.