Skip to content

SRGSSR/srgdataprovider-apple

Repository files navigation

SRG Data Provider logo

GitHub releases platform SPM compatible GitHub license

About

The SRG Data Provider library provides a simple way to retrieve metadata for all SRG SSRG business units in a common format.

The library provides:

  • Requests to get the usual metadata associated with SRG SSR productions.
  • A flat object model to easily access the data relevant to front-end users.
  • Combine data publishers available for iOS 13+, tvOS 13+ and watchOS 6+.
  • An alternative way to perform requests for applications which cannot use Combine, based on SRG Network.

Compatibility

The library is suitable for applications running on iOS 12, tvOS 12, watchOS 5 and above. The project is meant to be compiled with the latest Xcode version.

Contributing

If you want to contribute to the project, have a look at our contributing guide.

Integration

The library must be integrated using Swift Package Manager directly within Xcode. You can also declare the library as a dependency of another one directly in the associated Package.swift manifest.

Usage

When you want to use classes or functions provided by the library in your code, you must import it from your source files first. Projects in Swift can either use the Combine API:

import SRGDataProviderCombine

or SRG Network based requests and queues:

import SRGDataProviderNetwork

Objective-C applications can only use the SRG Network based API:

@import SRGDataProviderNetwork;

Both approaches can be used within the same project, though you should preferably choose one approach and stick with it for consistency.

Where only data model references are required, you can simply import the model framework, in Swift:

import SRGDataProviderModel

or in Objective-C:

@import SRGDataProviderModel;

For Swift projects supporting iOS 13+, tvOS 13+ or watchOS 6+, the use of Combine is strongly recommended, as it allows SRG SSR data retrieval tasks to be freely and reliably mixed with other asynchronous work (e.g. local data retrieval from a Core Data stack).

Working with the library

To learn about how the library can be used, have a look at the getting started guide.

Logging

The library internally uses the SRG Logger library for logging, within the ch.srgssr.dataprovider subsystem. This logger either automatically integrates with your own logger, or can be easily integrated with it. Refer to the SRG Logger documentation for more information.

Supported requests

The supported requests vary depending on the business unit. A compatibility matrix is provided for reference.

Examples

To see examples of use, have a look a the unit test suite bundled with the project.

License

See the LICENSE file for more information.