Swift Package Index

SOSwift

https://github.com/richardpiazza/SOSwift.git

A swift implementation of Schema.org structured data vocabulary.


SOSwift

A swift implementation of Schema.org structured data vocabulary.

Usage

SOSwift is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/SOSwift.git", .upToNextMinor(from: "1.1.0"))
    ],
    ...
)

Then import the SOSwift package wherever you'd like to use it:

import SOSwift

Schema.org

Schema.org is a collaborative, community activity with a mission to create, maintain, and promote schemas for structured data on the Internet, on web pages, in email messages, and beyond. This library implements some of the core vocabulary in the Swift language. This work is based on the 3.4 version of the Schema.org vocabulary, and currently implements only the top level core Thing subclasses.

Significant Differences

Although this body of work tries to adhere as closely as possible to the defined vocabulary, some changes are required to make the API feel swifty.

Float

Schema.org uses 'Float' as it's floating-point decimal type. 'Double' is the standard floating-point type in Swift, so double replaces all instances of float.

Has/Is

Many of the classes use a has/is prefix on non-boolean variable names. This vocabulary removes these prefixes.

Pluralization

Classes with singular names of clearly arrays of types has been pluralized for clarity and consistency.