docs: Clarify conditional compilation restrictions with an example
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
https://skip.tools/docs/platformcustomization/#compiler-directives includes this warning:
Because the Skip tooling does not know the value of any symbols other than
os(Android)and!os(Android), we strongly recommend addingos(Android)or!os(Android)conditions to all#ifblocks, so that it is clear whether Skip should include or exclude the code for Android.
That line made no sense at all to me when I read it.
What it means to say is that #if !os(macOS) won't work, which is filed as #342. You have to rewrite it as #if !os(macOS) || os(Android).
The documentation would be much clearer with an example of issue #342 and the recommended workaround.
For example, this won't work, because Skip doesn't understand the symbol
os(macOS), or its negation!os(macOS).Text("Hello World") #if !os(macOS) // BUG this won't run on Android .italic() #endifInstead, use an "unnecessary"
os(Android):Text("Hello World") #if !os(macOS) || os(Android) .italic() #endifWe hope to address this issue in a future version of Skip.
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
Open the compiler directives section at https://skip.tools/docs/platformcustomization/#compiler-directives and review its existing warning about os(Android) and !os(Android). Add the issue's failing and recommended Swift examples, including the link to issue #342, then verify that the explanation clearly states what Skip does not understand and what the workaround changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100