Swiftpack.co -  Quartz/content as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Quartz/content
Code generated TypeScript and Swift types for Quartz GraphQL queries
.package(url: "https://github.com/Quartz/content.git", from: "0.2.21")

Quartz Content Queries

This repo contains shared GraphQL queries for Quartz content at content.qz.com/graphql.

Queries are used to automatically generate TypeScript types and React hooks for React projects, and Swift types for iOS projects, using Apollo. This repo hosts both an NPM package and a Swift package for client use.

Adding queries

Shared queries can be found in /Queries. Fragments that might be shared in multiple queries are grouped in /Queries/Fragments. Queries related to a single page or function are grouped into folders, for instance, /Queries/Home.

What about __typename?

There’s no need to include __typename in your queries! Types will be introspected automatically.

Generating type definitions

Type definitions are generated automatically when merging to the main branch. (See .github/workflows/generation.yml). However, it’s a good idea to run type generation locally before opening a PR; it can help catch errors like missing fragments or name collisions. If you’d like to test your PR in a consuming repo like qz-react, open the PR, wait for the bot to commit the type definitions, then install the resulting commit in your repo, e.g.:

npm i --save Quartz/content#mysha1

Releases

We’re using GitHub Releases (tags) for versioning. Click on “Releases”, then “Draft a new release”, and tag and title your release using semantic versioning. To update the package in a client project, use: npm i --save Quartz/content#0.0.8.

semver

Client usage

In React projects

npm i --save Quartz/content#0.1.0 # we’re using GitHub Releases (tags) for versioning

Hooks are automatically generated for each operation (query or mutation).

import { useLatestGuidesQuery } from '@quartz/content';

export default function MyComponent() {
	const { data, loading, error } = useLatestGuidesQuery( { variables: { perPage: 3 } } );

In iOS projects

// Package.swift
dependencies: [
    .package(url: "https://github.com/Quartz/content", from: "0.0.8"),
],

GitHub

link
Stars: 2
Last commit: 5 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

0.2.21
6 days ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API