FoundationICU

0.0.8

swiftlang/swift-foundation-icu

What's New

FoundationICU 0.0.8

2024-06-14T17:29:20Z

This release:

  • Introduced Cmake support.
  • Combined all targets into one.
  • Changed the include directory from unicode to _foundation_unicode to avoid conflicts with system ICU

What's Changed

  • Moved headers in ./unicode to ./include/unicode by @iCharlesHu in #25
  • Introduce CMake support for SwiftFoundationICU by @iCharlesHu in #22

Full Changelog: 0.0.7...0.0.8


Corresponding ICU Version: ICU 72.1

Foundation ICU

This version of the ICU4C project contains customized extensions for use by the Foundation package. It is automatically extracted from Apple OSS Distribution's ICU to add Swift Package Manager support. Improvements to ICU's core functionality should be proposed to the upstream ICU4C library and not to this package.

Versioning

See the following version matrix:

FoundationICU version ICU version
0.0.2 and below 70.1
0.0.3 and above 72.1

Adding FoundationICU as a Dependency

⚠️ This package is intended to be a dependency for the Foundation package. It is not useful as a "general purpose" ICU4C library because all files irrelevant to the SwiftPM build are removed. The package is considered a private implementation detail of Foundation, and its API surface and structure is likely to change between major versions.

To use the FoundationICU library in a SwiftPM project, add the following lines to the dependencies in your Package.swift file:

.package(url: "https://github.com/apple/swift-foundation-icu", from: "0.0.3"),

Include "FoundationICU" as a dependency for your target:

.target(name: "<target>", dependencies: [
    .product(name: "FoundationICU", package: "swift-foundation-icu"),
]),

Finally, add import FoundationICU to your source code. You should now be able to directly use/extend ICU types:

import FoundationICU

extension UCalendarAttribute {
    static let lenient = UCAL_LENIENT
    static let firstDayOfWeek = UCAL_FIRST_DAY_OF_WEEK
    static let minimalDaysInFirstWeek = UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
}

Future Improvements

  • Data file handling: currently, the data file is embedded in the embedded in the binary itself as [uint8_t] (see icu_packaged_data.h). In the future, we would like to check in the source files instead and build the data as a shared library to avoid the need to maintain and load a separate data file.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Dec 21 2024 20:09:16 GMT-1000 (Hawaii-Aleutian Standard Time)