Skip to content

Instantly share code, notes, and snippets.

View joel-perry's full-sized avatar

Joel Perry joel-perry

View GitHub Profile
@joel-perry
joel-perry / ApolloPublisher.swift
Created January 10, 2020 16:02
Combine publishers for Apollo iOS client
import Apollo
import Combine
/// Extending ApolloClient to provide a convenient entry point for the publishers
/// I tried to stay as close as possible to the signature of the associated Apollo function calls
extension ApolloClient {
func queryPublisher<Query: GraphQLQuery>(_ query: Query,
cachePolicy: CachePolicy? = nil,
context: UnsafeMutableRawPointer? = nil,
queue: DispatchQueue? = .main) -> Publishers.ApolloQuery<Query> {
@joel-perry
joel-perry / gist:17e02a92ae93d7208887
Last active July 18, 2018 06:09
Simple TapTempo class for Swift
class DTTapTempo {
private let timeOutInterval: NSTimeInterval
private let minTaps: Int
private var taps: [NSDate] = []
init(timeOut: NSTimeInterval, minimumTaps: Int) {
timeOutInterval = timeOut
minTaps = minimumTaps
}