FHIRModels

0.9.0

Swift library for FHIR® resource data models
apple/FHIRModels

What's New

The Sendable Release

2026-04-14T08:33:40Z
  • BREAKING CHANGES, The Sendable Release: makes all types adopt Swift Sendable, which means:
    • All types are now structs, all abstract types protocols. Resources and elements used to be open class and are now public struct
    • The initializers and Codable interfaces didn't change, depending on how "FHIRModels" is used in your projects there may be zero to lots of adjustments necessary
    • The top level FHIRType protocol is now Sendable
    • Abstract types, including but not exclusively Resource and DomainResource, can no longer be instantiated (and probably never needed to be), and FHIRAbstractResource has been removed
    • Specialized elements such as Age, Count, Distance, and Duration are mere typealiases of Quantity
    • Since the FHIR data models define recursive structures (e.g. "Patient" -> "Identifier" -> "Reference" -> "Identifier" -> ...), all-struct doesn't work in Swift. To work around this cyle, Identifier and Reference are now final class, Sendable
    • The second infinite loop is around ResourceProxy and Bundle. To break this cycle, ResourceProxy.bundle is now a indirect case
    • This finally addresses #26
    • Bump Swift tools version to 6.2
  • Update build models to 6.0.0-ballot4 (http://build.fhir.org/)

FHIRModels

0.9.0 🔥 FHIR DSTU2, STU3, R4, R4B, R5, build Works on macOS, iOS, watchOS, tvOS and Linux Swift Package Manager License

FHIRModels is a Swift library for FHIR® resource data models.

Features

  • Native Swift representation of FHIR resources, elements and data types
  • Separate targets for DSTU2, STU3, R4, R4B, R5 and latest build versions
  • Enforced non-nullability of mandatory parameters
  • Enums for most closed code systems
  • Enums to support value[x] types
  • Date/Time parsing, validation and conversion to and from NSDate
  • Swift Codable and Sendable

Requirements

FHIRModels works with Swift 5.7 and newer.

Installation

Swift Package Manager is the recommended way to add FHIRModels to your project:

  1. In Xcode 11 and newer, go to “File” » “Add Package Dependencies...”
  2. Search for “FHIRModels” in the panel that comes up or paste the full URL to the GitHub repository, then select the package
  3. Pick the versioning that best works for you (usually the current version and “up to next major”)
  4. In order to update the dependency, periodically select “Update to Latest Package Versions” from Xcode's “File” » ”Packages” menu

Alternatively, you can add FHIRModels to your Package.swift file as a dependency:

dependencies: [
    .package(url: "https://github.com/apple/FHIRModels.git",
            .upToNextMajor(from: "0.9.0"))
]

Usage

Learn how to use FHIRModels in our How To section.

Getting Involved

Please feel free to open GitHub issues for questions, suggestions or issues you may have. Because the majority of the codebase is generated we will not be able to accept Pull Requests at this time.

License

This work is APACHE 2.0 licensed.

FHIR® is the registered trademark of HL7 and is used with the permission of HL7. Use of the FHIR trademark does not constitute endorsement of this product by HL7.

Description

  • Swift Tools 6.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 08 2026 08:42:28 GMT-0900 (Hawaii-Aleutian Daylight Time)