Skip to content

Instantly share code, notes, and snippets.

Simon Ljungberg simme

Block or report user

Report or block simme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CombineFrame.swift
private final class OfferingButton: UIViewController {
@Published private var frame: CGRect = .zero
private var subscriptions: [AnyCancellable] = []
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
$frame.removeDuplicates()
View collectionview.swift
import SwiftUI
extension String: Identifiable {
public var id: String { self }
}
struct CollectionViewSizeKey<ID: Hashable>: PreferenceKey {
typealias Value = [ID: CGSize]
static var defaultValue: [ID: CGSize] { [:] }
View scrollthing.swift
import SwiftUI
struct RoundedCorner: Shape {
var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners
func path(in rect: CGRect) -> Path {
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
return Path(path.cgPath)
View scrollthing.swift
import SwiftUI
struct RoundedCorner: Shape {
var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners
func path(in rect: CGRect) -> Path {
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
return Path(path.cgPath)
View patterns.swift
enum MySpecialEnum {
case someCase
case someCaseWithAssociatedData(String)
case someCaseWithNumbers(Int)
}
func handleSpecialEnum(_ value: MySpecialEnum) {
switch value {
case .someCase:
View BlurrBackgroundButton.swift
public final class BlurryBackgroundButton: UIControl {
public init() {
super.init(frame: .zero)
setup()
}
public override init(frame: CGRect) {
super.init(frame: frame)
setup()
View ShortcutManager.swift
/**
This sample code is available under the MIT license.
*/
@available(iOS 12.0, *)
public final class ShortcutManager {
/**
This enum specifies the different intents available in our app and their various properties for the `INIntent`.
Replace this with your own shortcuts.
View ParallaxHeader.swift
//
// ParallaxHeader.swift
// MealPlanUI
//
// Created by Simon Ljungberg on 2017-11-15.
// Copyright © 2017 Filibaba. All rights reserved.
//
import Foundation
import UIKit
View keybase.md

Keybase proof

I hereby claim:

  • I am simme on github.
  • I am simmelj (https://keybase.io/simmelj) on keybase.
  • I have a public key ASADuVzngznoJZLHqpiRN_Xf1Ky1CmfWOBrffVicRrhCRAo

To claim this, I am signing this object:

@simme
simme / Label.swift
Created May 16, 2018
A `UILabel` subclass that allows content padding.
View Label.swift
// MIT License applies.
import UIKit
/**
A `UILabel` subclass that provides a way of adding padding to the label.
*/
open class Label: UILabel {
/// The amount of padding for each side in the label.
You can’t perform that action at this time.