Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
extension View { | |
// MARK: Vertical Center | |
func vCenter() -> some View { | |
self | |
.frame(maxHeight: .infinity, alignment: .center) | |
} | |
// MARK: Vertical Top | |
func vTop() -> some View { |
import SwiftUI | |
extension Calendar { | |
func generateDates( | |
inside interval: DateInterval, | |
matching components: DateComponents | |
) -> [Date] { | |
var dates: [Date] = [] | |
dates.append(interval.start) |
class FreedrawingImageViewCG: UIImageView { | |
var currentTouchPosition: CGPoint? | |
override func layoutSubviews() { | |
super.layoutSubviews() | |
isUserInteractionEnabled = true | |
} | |
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { |
/// An extension to provide conversion to and from HSL (hue, saturation, lightness) colors. | |
extension UIColor { | |
/// The HSL (hue, saturation, lightness) components of a color. | |
struct HSL: Hashable { | |
/// The hue component of the color, in the range [0, 360°]. | |
var hue: CGFloat | |
/// The saturation component of the color, in the range [0, 100%]. | |
var saturation: CGFloat |
class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
let attributes = super.layoutAttributesForElements(in: rect) | |
var leftMargin = sectionInset.left | |
var maxY: CGFloat = -1.0 | |
attributes?.forEach { layoutAttribute in | |
if layoutAttribute.frame.origin.y >= maxY { | |
leftMargin = sectionInset.left |
import Cocoa | |
// This will work with Swift 5 | |
extension NSImage { | |
func image(with tintColor: NSColor) -> NSImage { | |
if self.isTemplate == false { | |
return self | |
} | |
let image = self.copy() as! NSImage |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |