Skip to content

Instantly share code, notes, and snippets.

@maxgribov
maxgribov / SwiftAsyncAPIAdoption.swift
Last active December 16, 2023 20:44
Swift async api adoption
import Foundation
import Combine
struct Page<Item> {
typealias LoadMoreCompletion = (Result<[Item], Error>) -> Void
let items: [Item]
let loadMore: (@escaping LoadMoreCompletion) -> Void
@maxgribov
maxgribov / CustomTransitions.swift
Created April 9, 2023 11:47
Custom SwiftUI transitions playground.
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State private var isPresented = false
var body: some View {
ZStack {
@maxgribov
maxgribov / printInputSources.m
Last active August 11, 2016 20:20
Print Mac OS X Text Input Source Services
/*
#import <Carbon/Carbon.h>
*/
- (void)printInputSources {
CFArrayRef sourceList = TISCreateInputSourceList (NULL, true);
int sourceCount = CFArrayGetCount(sourceList);
for (int i = 0; i < sourceCount; i++) {