Skip to content

Instantly share code, notes, and snippets.

@fxm90
fxm90 / Combine-PassthroughSubject-CurrentValueSubject.swift
Last active November 17, 2021 00:51
Playground showing the difference between a `PassthroughSubject` and a `CurrentValueSubject`
//
// Combine-PassthroughSubject-CurrentValueSubject.playground
//
// Created by Felix Mau on 30.07.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import Combine
@fxm90
fxm90 / Combine-CLLocationManagerDelegate.swift
Last active July 13, 2023 09:15
Playground showing how to convert a delegate pattern to combine publishers.
//
// Combine-CLLocationManagerDelegate.playground
//
// Created by Felix Mau on 30.07.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import Combine
import CoreLocation
@fxm90
fxm90 / Redux.swift
Last active December 12, 2022 10:52
Playground showing how to use Redux with SwiftUI.
//
// Redux.playground
//
// Created by Felix Mau on 25.06.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import SwiftUI
@fxm90
fxm90 / Font+Formatting.swift
Last active June 28, 2021 07:50
Extension that converts Strings with basic HTML tags to SwiftUI's Text (Supports SwiftUI 1.0 / iOS 13.0).
//
// Font+Formatting.swift
//
// Created by Felix Mau on 12.11.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import Foundation
import SwiftUI
@fxm90
fxm90 / swiftui.stencil
Last active May 2, 2022 04:00
A stencil template for generating SwiftUI assets with SwiftGen. Currently only `Image` and `Color` are supported.
//
// Do not edit! File generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
//
// SwiftUI Template by Felix Mau – https://felix.hamburg
//
// Latest version available at https://gist.github.com/fxm90/d1eb5439ad0f45d727bdb98132e933a6
//
import SwiftUI
@fxm90
fxm90 / CombinePublishedVsCurrentValueSubject.swift
Last active May 2, 2021 17:38
Gist showing the difference between the property wrapper `@Published` and a `CurrentValueSubject`
//
// CombinePublishedVsCurrentValueSubject.playground
//
// Created by Felix Mau on 09.02.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import Foundation
import Combine
@fxm90
fxm90 / ColoredToggleStyle.swift
Last active May 26, 2021 06:20
A fully configurable toggle style for SwiftUI.
//
// ColoredToggleStyle.swift
//
// Created by Felix Mau on 29.03.2021.
// Copyright © 2021 Felix Mau. All rights reserved.
//
/// A fully configurable toggle style.
struct ColoredToggleStyle: ToggleStyle {
@fxm90
fxm90 / PDFBase64ToImageViewController.swift
Created April 20, 2021 12:15
Playground showing how to convert a base 64 encoded PDF to an UIImage.
//
// PDFBase64ToImageViewController.swift
//
// Created by Felix Mau on 20.04.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import UIKit
import PDFKit
@fxm90
fxm90 / Combine+Pairwise.swift
Last active May 7, 2025 14:59
Extension for a Combine-Publisher that returns the current and previous value.
//
// Combine+Pairwise.swift
//
// Created by Felix Mau on 17.05.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import Combine
extension Publisher {
@fxm90
fxm90 / CheckboxToggleStyle.swift
Last active March 31, 2023 17:38
A fully configurable toggle style for SwiftUI, making the Toggle look like a checkbox.
//
// CheckboxToggleStyle.swift
//
// Created by Felix Mau on 25.05.2021.
// Copyright © 2021 Felix Mau. All rights reserved.
//
/// A fully configurable toggle style for SwiftUI, making the Toggle look like a checkbox.
struct CheckboxToggleStyle: ToggleStyle {