Skip to content

Instantly share code, notes, and snippets.

Avatar

Felix M. fxm90

View GitHub Profile
@fxm90
fxm90 / Dictionary+MapKeys.swift
Created Jun 14, 2021
Counterpart methods to `mapValues(_:)` and `compactMapValues(_:)`
View Dictionary+MapKeys.swift
//
// Dictionary+MapKeys.swift
//
// Created by Felix Mau on 14.06.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
extension Dictionary {
/// Returns a new dictionary containing the keys transformed by the given closure.
/// The values of this dictionary stay the same.
@fxm90
fxm90 / CheckboxToggleStyle.swift
Last active May 27, 2021
A fully configurable toggle style for SwiftUI, making the Toggle look like a checkbox.
View CheckboxToggleStyle.swift
//
// 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 {
@fxm90
fxm90 / Combine+Pairwise.swift
Created May 17, 2021
Extension for a Combine-Publisher that returns the current and previous value.
View Combine+Pairwise.swift
//
// Combine+Pairwise.swift
//
// Created by Felix Mau on 17.05.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import Combine
extension Publisher {
@fxm90
fxm90 / PDFBase64ToImageViewController.swift
Created Apr 20, 2021
Playground showing how to convert a base 64 encoded PDF to an UIImage.
View PDFBase64ToImageViewController.swift
//
// 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 / ColoredToggleStyle.swift
Last active May 26, 2021
A fully configurable toggle style for SwiftUI.
View ColoredToggleStyle.swift
//
// 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 / CombinePublishedVsCurrentValueSubject.swift
Last active May 2, 2021
Gist showing the difference between the property wrapper `@Published` and a `CurrentValueSubject`
View CombinePublishedVsCurrentValueSubject.swift
//
// CombinePublishedVsCurrentValueSubject.playground
//
// Created by Felix Mau on 09.02.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import Foundation
import Combine
@fxm90
fxm90 / swiftui.stencil
Last active Feb 16, 2021
A stencil template for generating SwiftUI assets with SwiftGen. Currently only `Image` and `Color` are supported.
View swiftui.stencil
//
// 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 / Font+Formatting.swift
Last active Nov 27, 2020
Extension that converts Strings with basic HTML tags to SwiftUI's Text.
View Font+Formatting.swift
//
// Font+Formatting.swift
//
// Created by Felix Mau on 12.11.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import Foundation
import SwiftUI
@fxm90
fxm90 / Redux.swift
Last active Nov 23, 2020
Playground showing how to use Redux with SwiftUI.
View Redux.swift
//
// Redux.playground
//
// Created by Felix Mau on 25.06.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import Combine
import SwiftUI
@fxm90
fxm90 / Combine-CLLocationManagerDelegate.swift
Created Jul 31, 2020
Playground showing how to convert a delegate pattern to combine publishers.
View Combine-CLLocationManagerDelegate.swift
//
// Combine-CLLocationManagerDelegate.playground
//
// Created by Felix Mau on 30.07.20.
// Copyright © 2020 Felix Mau. All rights reserved.
//
import PlaygroundSupport
import Foundation
import CoreLocation