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 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.
View UIView+AutoLayout.swift
//
// UIView+AutoLayout.swift
//
// Created by Simon Ljungberg on 28/12/16.
// Copyright © 2016 Redhill. All rights reserved.
//
import UIKit
public extension UIView {
@simme
simme / pixels.processing
Created Feb 5, 2018
Processing pixel manip
View pixels.processing
void setup() {
fullScreen();
frameRate(15);
}
void draw() {
// Loads all pixels on screen into an array of size width*height
loadPixels();
color onColor = #000000;
color offColor = #FFFFFF;
@simme
simme / UITabBarController+ToggleTabBar.swift
Created Jan 25, 2018
Extension on UITabBarController for hiding/showing the tab bar.
View UITabBarController+ToggleTabBar.swift
extension UITabBarController {
/**
Show or hide the tab bar.
- Parameter hidden: `true` if the bar should be hidden.
- Parameter animated: `true` if the action should be animated.
- Parameter transitionCoordinator: An optional `UIViewControllerTransitionCoordinator` to perform the animation
along side with. For example during a push on a `UINavigationController`.
*/
@simme
simme / UITextView+FadeLast.swift
Last active Nov 20, 2017
Fades the last line of a `UITextView` horizontally, instead of truncating it.
View UITextView+FadeLast.swift
extension UITextView {
var lineFrames: [CGRect] {
let numberOfGlyphs = layoutManager.numberOfGlyphs
var numberOfLines = 0
var index = 0
var lineRange = NSRange()
let maxNumberOfLines = textContainer.maximumNumberOfLines
var lineRects = [CGRect]()
while (index < numberOfGlyphs) {
You can’t perform that action at this time.