Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Add Apple Foundation compatibility #30

@colemancda

Description

@colemancda

Motivation

Apple has finally implemented Pure Swift value types for Foundation in Swift 3.0, but there are some issues with this:

  • Only a subset of types like Date are truly value type structs, the rest are structs, but backed by a reference type.
  • JSON is still AnyObject, not an enum
  • OSS Foundation is huge, will still have the CoreFoundation codebase, and it will still keep the NS* classes. This is not desirable for a Pure Swift portable library.
  • With Xcode, SwiftFoundation is a PITA to use because the types conflict with the new Foundation value types, which are imported implicitly.
  • They have only implemented this as a Swift addition in Darwin, the Linux support is still lacking, hence making this project still necessary.
  • This project provides a lot of functionality that OSS Foundation does not provide.
  • The compiled binary for this project is tiny compared to OSS Foundation.
  • OSS Foundation still depends on non-posix C libraries like CoreFoundation
  • Not as portable as SwiftFoundation because it's not truly Pure Swift.

Solution

  • Make conflicting types only compile on Linux. On Darwin we will remove the implementation of conflicting types, and make any additions extensions (e.g. RawRepresentable for UUID).
  • Update APIs to have to mirror the Darwin APIs
  • Keep all additions (e.g. HTTP.StatusCode, Null, JSON.Value) for both platforms.
  • Remove FoundationConvertible since ReferenceConvertible exists.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions