Skip to content

Instantly share code, notes, and snippets.

@romdevios
romdevios / DynamicParameterStore.swift
Last active October 21, 2023 09:10
This struct can store flexible amount of parameters that will be type safe to use.
import Foundation
@dynamicMemberLookup
struct DynamicParameterStore<Holder, Wrapped> {
private let holder: Holder
private let wrapped: Wrapped
subscript<Value>(dynamicMember keyPath: KeyPath<Holder, Value>) -> Value {
holder[keyPath: keyPath]
}
@romdevios
romdevios / VerticalContentButton.swift
Last active December 21, 2021 10:36
UIButton that align image and title vertically considering edge insets and content alignment.
//
// VerticalContentButton.swift
//
// Created by Roman Filippov on 10.11.2021.
// Copyright © 2021 com.its. All rights reserved.
//
import UIKit
/// Allign image and title vertically considering edge insets and content aligment