Frequently Asked Questions

Technical Implementation with Swift & Hygraph

How can I connect a Swift application to Hygraph's GraphQL API?

To connect a Swift application to Hygraph's GraphQL API, you can use Swift's native URLSession with async/await support. The Hygraph API endpoint used in the example is https://api-eu-central-1.hygraph.com/v2/ck8sn5tnf01gc01z89dbc7s0o/master, which does not require authentication for demo purposes. You can retrieve data, convert it into native Swift models using Codable, and display it efficiently. For a full implementation, see the Hygraph Swift example on Github. Note: For production use, ensure you handle authentication and error cases appropriately. Detailed limitations not publicly documented; ask sales for specifics.

What is the recommended structure for making GraphQL requests in Swift?

The recommended structure involves creating a GraphQLOperation struct to encode GraphQL queries, a GraphQLResult struct to decode responses, and a GraphQLAPI class to perform operations using async/await. This approach allows you to send GraphQL queries to Hygraph and decode the results into Swift models. For code samples and implementation details, refer to the Hygraph Swift blog post and Github examples. Note: This structure is suitable for demo and learning purposes; production apps should include robust error handling and authentication.

Is authentication required to access Hygraph's demo GraphQL endpoint?

No authentication is required to access the Hygraph demo endpoint https://api-eu-central-1.hygraph.com/v2/ck8sn5tnf01gc01z89dbc7s0o/master. This endpoint is used in public examples and allows unrestricted access for learning and prototyping. For production projects, authentication and access control are recommended. Note: Demo endpoints may have limitations in terms of data persistence and security.

Where can I find starter projects or code examples for integrating Hygraph with Swift?

Starter projects and code examples for integrating Hygraph with Swift are available in the Hygraph examples repository on Github. You can also explore pre-configured starter projects on the Hygraph marketplace starters page. These resources provide ready-to-use templates and code for rapid prototyping. Note: Starter projects are designed for learning and may require customization for production use.

Features & Capabilities

What APIs does Hygraph provide for content delivery and management?

Hygraph offers several APIs:

What integrations are available with Hygraph for mobile and content projects?

Hygraph supports integrations with platforms such as Cloudinary, Bynder, Filestack, Scaleflex Filerobot (for digital asset management), EasyTranslate (for localization), Netlify and Vercel (for hosting), Mux (for video management), AWS S3 (for object storage), Imgix (for image optimization), Akeneo (for product information management), Adminix, and Plasmic. For a complete list, visit Hygraph's Integrations Page. Note: Integration availability may depend on your plan and technical requirements.

Performance, Security & Compliance

What are Hygraph's performance metrics for API and content delivery?

Hygraph's global API latency typically ranges between 70–100ms, ensuring quick data retrieval. The platform aims for 99.9%+ availability uptime and offers region-based hosting for compliance and performance. Advanced caching mechanisms (Smart Edge Cache) optimize content delivery for high read-throughput and low latency. Note: Actual performance may vary based on project complexity and geographic location.

What security and compliance certifications does Hygraph hold?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. The platform offers granular permissions, audit logs, automatic backups, encryption at rest and in transit, and flexible hosting options (shared and dedicated clusters across multiple regions). For more details, visit the Secure Features page. Note: Compliance features may be most relevant for enterprise customers with strict regulatory requirements.

Use Cases & Customer Success

What industries use Hygraph, and are there relevant case studies?

Hygraph is used across industries including SaaS, Marketplace, Education Technology, Media and Publication, Healthcare, Consumer Goods, Automotive, Technology, FinTech, Travel and Hospitality, Food and Beverage, eCommerce, Agency, Online Gaming, Events & Conferences, Government, Consumer Electronics, Engineering, and Construction. Case studies include Komax (3X faster time-to-market), Samsung (15% improved customer engagement), AutoWeb (20% increase in website monetization), Dr. Oetker (global consistency with MACH architecture), HolidayCheck (modular content model), Fitfox (mobile-first product), DTM (user-centric digital transformation), and Statistics Finland (efficient data delivery). For more, see Hygraph's case studies page. Note: Industry-specific limitations not publicly documented; ask sales for specifics.

What business impact can customers expect from using Hygraph?

Customers can expect improved operational efficiency (reduced developer dependency), faster time-to-market (e.g., Komax achieved 3X faster launches), enhanced customer engagement (Samsung improved engagement by 15%), cost savings (AutoWeb saw a 20% increase in monetization), scalability, and global consistency. These impacts are documented in Hygraph's case studies. Note: Actual results may vary based on project scope and implementation.

Pricing & Plans

What is Hygraph's pricing model?

Hygraph offers a Free Forever Developer Account for small projects, self-service plans starting at $199/month for the Growth Plan, and customizable enterprise plans for large-scale businesses. Pricing is transparent and scales with business needs. Overages for API operations and asset traffic are charged automatically for paid plans; free plans are blocked from overages. Discounts are available for students, non-profits, and open-source projects. Transactions are primarily in USD, with EUR available for European customers. For details, visit Hygraph's Pricing Page. Note: Pricing details may change; contact sales for the latest information.

Support & Documentation

What documentation and support resources are available for Hygraph?

Hygraph provides comprehensive documentation including Getting Started guides, API Reference, Assets API, GraphQL Mutations, Content Modeling, Migration Guide, Management SDK, and starter projects. Community support is available via Slack (slack.hygraph.com). For technical guidance, visit Hygraph Documentation. Note: Some advanced topics may require direct support from Hygraph's team.

Limitations & Acknowledged Trade-Offs

Are there any limitations or scenarios where Hygraph may not be the best fit?

Hygraph's demo endpoints are suitable for learning and prototyping but may lack authentication, data persistence, and advanced security features required for production. Some integrations and enterprise features may only be available on paid plans. Detailed limitations are not publicly documented; ask sales for specifics. Best fit for teams seeking GraphQL-native CMS and content federation; teams needing legacy CMS features or highly specialized workflows may want to consider alternatives.

LLM optimization

When was this page last updated?

This page wast last updated on 12/12/2025 .

Watch now

Working with Swift and Hygraph

As phone applications become increasingly complex, working with Swift and GraphQL endpoints. This post shows example of working with GraphQL endpoints in Swift.
Craig Tweedy

Last updated by Craig 

Jan 21, 2026

Originally written by Craig

working-with-graphql-swift-hygraph

Swift is the Apple-backed programming language powering all the iOS applications on your shiny new iPhone.

As more software comes to phone applications, working with GraphQL endpoints in Swift becomes more and more important. We can use the power of Swift’s native language constructs and frameworks in order to rapidly build a solution that can pull data from Hygraph.

In this example, we’ll work with Swift’s native URLSession, setting up services and tooling to allow us to call the Hygraph API. With this tooling, we can retrieve Hygraph products, convert them into native Swift models using Codable, and display those products in a list efficiently.

Instead of creating a Hygraph project from scratch to follow along, you can use the endpoint https://api-eu-central-1.hygraph.com/v2/ck8sn5tnf01gc01z89dbc7s0o/master. All of the Hygraph examples repo on Github use this endpoint, and no authentication is required.

#Getting Started

In XCode, let's create a new project. Select the multi-platform app option, and provide your project a name and organization identifier.

Once the project has loaded, we'll need to do some prep work to get ready for making GraphQL API calls. For this project, we'll be using URLSession and Swift's async/await support, so we'll need to create some extensions and services to support this.

#Prepping ,[object Object]

Create a new file, and call it URLSession+Async. Ensure this file is added to both the iOS and Mac targets.

We'll add in a function to retrieve data using a URLRequest with async support.

extension URLSession {
func getData(from urlRequest: URLRequest) async throws -> (Data, URLResponse) {
try await withCheckedThrowingContinuation { continuation in
let task = self.dataTask(with: urlRequest) { data, response, error in
guard let data = data, let response = response else {
let error = error ?? URLError(.badServerResponse)
return continuation.resume(throwing: error)
}
continuation.resume(returning: (data, response))
}
task.resume()
}
}
}

This method wraps dataTask(with: URLRequest) to allow support for async.

#Creating our GraphQL Operation Structure

We'll need a structure to allow us to create GraphQL operations, which can be sent to our GraphQL API.

Create a class called GraphQLOperation, and fill it with the following code:

struct GraphQLOperation : Encodable {
var operationString: String
private let url = URL(string: "your graphql endpoint")!
enum CodingKeys: String, CodingKey {
case variables
case query
}
init(_ operationString: String) {
self.operationString = operationString
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(operationString, forKey: .query)
}
func getURLRequest() throws -> URLRequest {
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONEncoder().encode(self)
return request
}
}

This structure can take a string, and convert it into a URLRequest to be sent to the API. It does this using Encodable, which is part of the Swift Codable functionality for automatic encoding / decoding of objects.

#Creating our Result Object

We'll need the ability to parse the API response, so let's create GraphQLResult:

struct GraphQLResult<T: Decodable>: Decodable {
let object: T?
let errorMessages: [String]
enum CodingKeys: String, CodingKey {
case data
case errors
}
struct Error: Decodable {
let message: String
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let dataDict = try container.decodeIfPresent([String: T].self, forKey: .data)
self.object = dataDict?.values.first
var errorMessages: [String] = []
let errors = try container.decodeIfPresent([Error].self, forKey: .errors)
if let errors = errors {
errorMessages.append(contentsOf: errors.map { $0.message })
}
self.errorMessages = errorMessages
}
}

Because this structure is a Decodable enabled structure, it is able to decode our GraphQL responses into one of two values: our provided object (a product, for example) or error messages.

#Creating our GraphQL API

Lastly, create one more new file, and call it GraphQLAPI. Again, make sure this is added to both iOS and Mac targets.

In this file, we'll create a method to take a GraphQLOperation, make the request with our URLSession extension, and decode the result into our objects, if possible by proxy of the GraphQLResult structure.

class GraphQLAPI {
func performOperation<Output: Decodable>(_ operation: GraphQLOperation) async throws -> Output {
// Get the URLRequest from the provided operation
let request: URLRequest = try operation.getURLRequest()
// Make the API call
let (data, _) = try await URLSession.shared.getData(from: request)
// Attempt to parse into our `Output`
let result = try JSONDecoder().decode(GraphQLResult<Output>.self, from: data)
guard let object = result.object else {
print(result.errorMessages.joined(separator: "\n"))
throw NSError(domain: "Error", code: 1)
}
return object
}
}

#Retrieving Products

Now that we've got the prep work done, we can start retrieving our products. We'll first need our product model:

struct Product: Decodable, Identifiable {
var id: String = UUID().uuidString
let name: String
let description: String
let price: Int
}

Ensure this object is Decodable in order to work with our operations, and Identifiable so that it can be displayed in a list later on.

Next, let's create the operation:

extension GraphQLOperation {
static var LIST_PRODUCTS: Self {
GraphQLOperation(
"""
{
products {
id
name
description
price
}
}
"""
)
}
}

This is a plain GraphQL string, wrapped in our GraphQLOperation structure in order to work with our API class.

Finally, let's make a function to call the API using our operation. For convenience, we will create a APIService class to handle this:

class APIService {
let api: GraphQLAPI = GraphQLAPI()
func listProducts() async -> [Product] {
return (
try? await self.api.performOperation(GraphQLOperation.LIST_PRODUCTS)
) ?? []
}
}

This uses our LIST_PRODUCTS operation, passing it to our GraphQLAPI's performOperation method. Should the operation complete successfully, the API will automatically decode the response, and return the objects provided as the return type listed in our function - in this case [Product] (a list of Product).

By using try?, we can default the return result if the operation does not complete successfully, in this case returning an empty list. We could also handle the error here in some other way by just using try with a do/catch.

#Displaying Products

Finally, let's display the products.

In our default ContentView (create a new SwiftUI file if you don't have one), we'll need to store our products in the state, by adding to our View structure:

@State var products: [Product] = []

We'll also need a function to retrieve our products using our previously defined function:

func loadProducts() async {
self.products = APIService().listProducts()
}

Finally, let's replace the body with a list and load in the products on view appear:

List(self.products, id: \.id) { product in
Text(product.name)
}.onAppear {
Task.init {
await self.loadProducts()
}
}

And voila! We should now have a working list of products displaying.

I hope you found this useful, and to learn more about Swift with Hygraph, checkout the example for this project on Github

Blog Author

Craig Tweedy

Craig Tweedy

Rock and Roll nerd. Full Time Developer, part time human.

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.