Skip to content

Instantly share code, notes, and snippets.

View PabloDomine's full-sized avatar

Pablo Dominé PabloDomine

  • Wallapop
  • Barcelona, Spain
View GitHub Profile
@manicaesar
manicaesar / SwiftPropertyOverloading.swift
Created September 24, 2021 19:10
Swift property overloading
struct StructWithTwoObjects {
let object: String
/*
var object: A { // Stupid, but causes compilation error - OK!
return self
}
*/
}
// ---------------------
@jordanmkoncz
jordanmkoncz / .react-navigation iOS 11 Navigation Bar with Large Title
Last active May 9, 2022 16:21
react-navigation iOS 11 Navigation Bar with Large Title
#
@kumabook
kumabook / Observable.swift
Last active March 12, 2022 06:47
Observer pattern with swift protocol extension
import Foundation
public protocol Observer: Equatable {
associatedtype EventType
func listen(_ event: EventType)
}
public protocol Observable {
associatedtype ObserverType: Observer
associatedtype EventType
@firefightingcode
firefightingcode / UILabel+Spacing.swift
Created November 26, 2015 15:02
An extension for UILabel to set text with specific kerning, line spacing or line height multiple
import UIKit
extension UILabel {
func setText(text: String, withKerning kerning: Double) {
self.attributedText = NSAttributedString(string: text, attributes: kerningAttribute(kerning))
}
func setText(text: String, withLineSpacing lineSpacing: CGFloat) {
self.attributedText = NSAttributedString(string: text, attributes: lineSpacingAttribute(lineSpacing))