skiptools / skiptools/skip

`skip init` should create `Package.swift` in a subdirectory

Open
#453 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

project
Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

Apropos #448, the Xcode workspace structure for a generated project is (still) extremely strange.

skip init creates an Xcode project .xcodeproj in the ./Darwin folder, and creates a ./Package.swift file in the generated root folder.

To make the generated library visible in the project, the root ./ folder is added to the .xcodeproj by reference, and the library name e.g. ModuleName is added as a dependency of the app project. A few file references are tossed in to the project, too, including README.md, Skip.env, and Localizable.xcstrings.

I think the normal way to have an app project that references a Swift library is to have the library appear in a ModuleName subdirectory next to the Darwin directory. Instead of:

Project.xcworkspace
Darwin/ModuleName.xcodeproj
Package.swift
Sources/ModuleName/ModuleNameApp.swift

It would look like this:

Project.xcworkspace
Darwin/ModuleName.xcodeproj
ModuleName/Package.swift
ModuleName/Sources/ModuleNameApp.swift

This would make the project structure much less confusing, IMO.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the implementation of skip init and inspect how it generates Package.swift, Darwin/ModuleName.xcodeproj, and Sources/ModuleName/ModuleNameApp.swift. Compare the generated output with the proposed layout, then verify that the package is created under ModuleName beside Darwin and that the generated project still references it correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.