Skip to content

Instantly share code, notes, and snippets.

View nrivard's full-sized avatar

Nate Rivard nrivard

View GitHub Profile
@nrivard
nrivard / AppIconGenerator.scpt
Last active April 29, 2022 03:05
Automate iOS App Store icons using Pixelmator Pro
use scripting additions
set desktopPath to (path to desktop as text)
set folderPath to desktopPath & "exports"
set exportFolder to ""
tell application "Finder"
if (exists folder folderPath) is false then
make new folder at desktopPath with properties {name:"exports"}
end if
@nrivard
nrivard / SwiftUI-Bug.swift
Created April 23, 2020 14:29
Multiplatform SwiftUI code that fails on macOS
import SwiftUI
struct ContentView: View {
var body: some View {
List {
ScrollySection(sectionName: "Section 1")
ScrollySection(sectionName: "Section 2")
ScrollySection(sectionName: "Section 3")
}
@nrivard
nrivard / combine+result.swift
Created August 2, 2019 22:07
Using Result<Success, Failure> with Combine
import Combine
extension Publisher {
/// A single value sink function that coalesces either one `Output` or one `Failure` as a `Result`-type.
public func sink(result: @escaping ((Result<Self.Output, Self.Failure>) -> Void)) -> AnyCancellable {
return sink(receiveCompletion: { completion in
switch completion {
case .failure(let error):
result(.failure(error))