Foundation is huge in file size and complexity. It is difficult to build, tedious to update, and relying on it is blocking us from moving to new platforms (like the browser). As an open source project swift-corelibs-foundation has not gained a huge amount of traction and appears to be only implementing the bare minimum. In general, it seems like the Swift community is looking to replace it with lighter more specific modules. We would also do better to remove it and implement what we need from it in other ways wherever possible.
This PR makes it clear that we are really only relying on a few key parts of Foundation in UIKit-Cross-Platform:
URL (in AVURLAsset, which can be split out and implemented differently)
Data
NSAttributedString (which also requires NSRange for our purposes, but can probably be removed entirely)
Notification(Center)
Date (only to get the current timestamp – can be implemented differently)
Some of these dependencies will be easier to to remove than others, and that work should happen in a separate PR. For now, we just want to make explicit what we are actually using and remove some trivial dependencies directly.
Please check if the PR fulfills these requirements
[x] Self-review: I am confident this is the simplest and clearest way to achieve the expected behaviour
[x] The commit messages are clean and understandable
Type of change: DX
Motivation (current vs expected behavior)
Foundation
is huge in file size and complexity. It is difficult to build, tedious to update, and relying on it is blocking us from moving to new platforms (like the browser). As an open source project swift-corelibs-foundation has not gained a huge amount of traction and appears to be only implementing the bare minimum. In general, it seems like the Swift community is looking to replace it with lighter more specific modules. We would also do better to remove it and implement what we need from it in other ways wherever possible.This PR makes it clear that we are really only relying on a few key parts of
Foundation
in UIKit-Cross-Platform:URL
(inAVURLAsset
, which can be split out and implemented differently)Data
NSAttributedString
(which also requiresNSRange
for our purposes, but can probably be removed entirely)Notification(Center)
Date
(only to get the current timestamp – can be implemented differently)Some of these dependencies will be easier to to remove than others, and that work should happen in a separate PR. For now, we just want to make explicit what we are actually using and remove some trivial dependencies directly.
Please check if the PR fulfills these requirements