contentful / contentful.swift

A delightful Swift interface to Contentful's content delivery API.
MIT License
203 stars 81 forks source link

import Contentful // Retain the client as a property on a type you define so that // the client's asynchronous network callbacks are executed. let client = Client(spaceId: "<space_id>", environmentId: "<environment_id>", // Defaults to "master" if omitted accessToken: "<access_token>") // Snippets for the images API assume that you already have an `Asset` in memory. var asset: Asset = ... // Type passed into callback will be a UIImage or NSImage depending on the current platform. client.fetchImage(for: asset, with: [ImageOption.formatAs(.png(bits: .standard))]) { (image: Result<UIImage>) in switch result { case .success(let image): // Use the image. case .error(let error): print(error) } } #389

Open Cuongcj opened 1 year ago