Skip to content

Instantly share code, notes, and snippets.

View ohetzendorfer's full-sized avatar

Oliver Hetzendorfer ohetzendorfer

View GitHub Profile
@nalexn
nalexn / BinaryEquatable.swift
Created April 6, 2020 08:17
Equatable without the need to implement == func
protocol BinaryEquatable: Equatable { }
extension BinaryEquatable {
static func == (lhs: Self, rhs: Self) -> Bool {
withUnsafeBytes(of: lhs) { lhsBytes -> Bool in
withUnsafeBytes(of: rhs) { rhsBytes -> Bool in
lhsBytes.elementsEqual(rhsBytes)
}
}
}
@Sorix
Sorix / RoundedLabel.swift
Last active July 1, 2022 01:33
IBDesignable UILabel with rounded corners and paddings
import UIKit
@IBDesignable
class RoundedLabel: UILabel {
var edgeInsets: UIEdgeInsets {
if autoPadding {
if cornerRadius == 0 {
return UIEdgeInsets.zero
} else {