Skip to content

2.0.0: Formatting, FormatStyle, and canonical hyphenation

Latest

Choose a tag to compare

@nate-sentjens nate-sentjens released this 30 Jul 18:25
· 1 commit to main since this release
7a2c8d1

What's new

FormatStyle: ISBN.FormatStyle conforms to FormatStyle and ParseableFormatStyle, enabling idiomatic use across SwiftUI, UIKit, and anywhere format styles are accepted:

let isbn = ISBN("9780201896831")!

isbn.formatted()                  // "978-0-201-89683-1"

Text(isbn, format: .isbn)         // SwiftUI
TextField("ISBN", value: $isbn, format: .isbn)

Canonical hyphenation: isbn.hyphenated produces the correctly hyphenated ISBN-13 using the International ISBN Agency's range table (287 registration groups).

LosslessStringConvertible: String(isbn) now works as a cleaner alternative to String(describing: isbn).

Breaking changes

  • ASINClassification.init(classifying:) has been renamed to ASINClassification.init(of:).
  • The package now declares minimum platform versions (iOS 15+, macOS 12+, watchOS 8+, tvOS 12+, visionOS 1+) and requires Foundation.

Migration

- ASINClassification(classifying: asin)
+ ASINClassification(of: asin)

- String(describing: isbn)
+ String(isbn)