yonaskolb / yonaskolb/XcodeGen
Using frameworks with Carthage dependencies with playgrounds
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 8.8k
- Forks
- 908
- Avg merge
- 17d 14h
- Merged PRs (30d)
- 2
Description
XcodeGen 2.2.0, Xcode 10.1.
I can't get frameworks with framework and Carthage dependencies working with Xcode playgrounds. This might not be a XcodeGen issue at all, but it's possible XcodeGen could be doing something to help along here. I don't know the solution.
I have an iOS app split into frameworks where some of the frameworks depend on each other. The frameworks work fine in a playground. If I add Carthage dependencies into the mix, they stop working in the playground. In the application target they both work fine.
Here's a project.yml that works fine:
name: MyTestProject
options:
xcodeVersion: "1000"
bundleIdPrefix: "fi.juripakaste.xcodegentest.2f0d"
settingGroups:
default:
SWIFT_VERSION: 4.2
targets:
MyFramework:
platform: iOS
type: framework
sources:
- path: MyFramework/Sources
name: "My Framework"
dependencies:
- target: MyBaseFramework
settings:
groups: [default]
MyBaseFramework:
platform: iOS
type: framework
sources:
- path: MyBaseFramework/Sources
name: "My Base Framework"
settings:
groups: [default]
MyApplication:
platform: iOS
type: application
sources:
- path: MyApplication/Sources
name: "App (2f0d)"
dependencies:
- target: MyFramework
- target: MyBaseFramework
settings:
groups: [default]
Here's a project.yml where MyFramework won't work in playground (notice MyFramework depends on Differ):
name: MyTestProject
options:
xcodeVersion: "1000"
bundleIdPrefix: "fi.juripakaste.xcodegentest.2f1d"
settingGroups:
default:
SWIFT_VERSION: 4.2
targets:
MyFramework:
platform: iOS
type: framework
sources:
- path: MyFramework/Sources
name: "My Framework"
dependencies:
- carthage: Differ
- target: MyBaseFramework
settings:
groups: [default]
MyBaseFramework:
platform: iOS
type: framework
sources:
- path: MyBaseFramework/Sources
name: "My Base Framework"
settings:
groups: [default]
MyApplication:
platform: iOS
type: application
sources:
- path: MyApplication/Sources
name: "My Application (2f1d)"
dependencies:
- target: MyFramework
- target: MyBaseFramework
settings:
groups: [default]
In both cases I've opened the generated project, done a Save As Workspace…, then added a playground to the workspace. In both cases I have a public struct Bar in MyFramework that uses public struct Foo from MyBaseFramework. With the latter project, where I have the Carthage dependency, trying to instantiate a Bar in the playground results in this message:
error: Couldn't lookup symbols:
MyFramework.Bar.init(field: MyBaseFramework.Foo) -> MyFramework.Bar
type metadata for MyFramework.Bar
So the first question is slightly in the Stack Overflow territory: any ideas how to make this work? And second: is this a problem with XcodeGen or in how I've set up my project?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two project.yml variants with XcodeGen, then save each generated project as a workspace and add a playground. Compare the MyFramework, MyBaseFramework, and Carthage dependency setup while reproducing the MyFramework.Bar symbol lookup error. Done means determining whether the generated project causes the failure and documenting a confirmed resolution or limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100