# \[Pitch\] Extensible availability checking

**URL:** <https://forums.swift.org/t/pitch-extensible-availability-checking/79308>\
**Category:** Pitches\
**Tags:** availability\
**Created:** [April 16, 2025, 4:25pm UTC](https://forums.swift.org/t/pitch-extensible-availability-checking/79308 "2025-04-16T16:25:07Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![FlorianPircher](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/florianpircher/32/39919_2.png) [@FlorianPircher](https://forums.swift.org/u/FlorianPircher)\
**Post date:** [November 5, 2025, 10:24pm UTC](https://forums.swift.org/t/pitch-extensible-availability-checking/79308/18 "2025-11-05T22:24:49Z")

</div>

> [@Douglas\_Gregor](#):
>
> we should probably extend the library to make it easier to use without requiring the tables (e.g., making `String.UTF8View` be `Equatable` and `Comparable` using non-normalized comparison)

I was just about to open a new topic about this. `Hashable` for `String.UTF8View` would be very welcome as well.

> **Details about String wrapper**
>
> My use case is a type that shares many of the properties of `String` (guaranteed valid Unicode, small string optimization, …), but adheres to UTF-8 unit equality instead of Unicode equality. This is needed for interfacing with external systems that do not use Unicode equality and just treat strings as a collection of bytes. Also, such a type would be very helpful in Embedded Swift.
> 
> Currently, I can define a wrapper struct around `String`, but nothing offered by the pubic API (`a.utf8.elementsEqual(b.utf8)` or `withUTF8`) are as fast as the native `String` equality and hashing implementations.
> 
> Current effort: [Performant byte-based String wrapper](https://forums.swift.org/t/performant-byte-based-string-wrapper/72104/)
> 
> The above is still not as fast as `String` equality/hashing and not sound for strings with `\r\n` and stores an additional byte alongside each string.
> 
> With `String.UTF8View: Hashable`, I could implement such a wrapper type without additional storage requirements and minimal performance penalties.

---

_[View the full topic](https://forums.swift.org/t/pitch-extensible-availability-checking/79308)._
