Skip to content

Instantly share code, notes, and snippets.

@drewolbrich
drewolbrich / CommonProfile.metal
Created April 18, 2022 21:05 — forked from warrenm/CommonProfile.metal
SceneKit's CommonProfile Shader v2 (macOS 10.15)
View CommonProfile.metal
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
@drewolbrich
drewolbrich / UIColor+Attenuated.swift
Created December 12, 2021 18:48
Attenuates a UIColor, returning a dynamic color
View UIColor+Attenuated.swift
import UIKit
extension UIColor {
/// Creates a dynamic color from the receiver with attenuated brightness.
///
/// This method works correctly with light and dark mode. A dynamic color is
/// returned, so if the user switches to dark mode, the attenuated dark mode version of `self`
/// will be displayed.
func attenuated(by attenuation: CGFloat) -> UIColor {
@drewolbrich
drewolbrich / UIColor+Blended.swift
Last active December 12, 2021 18:46
Blends together two UIColors, returning a dynamic color
View UIColor+Blended.swift
import UIKit
extension UIColor {
/// Creates a dynamic color from the receiver blended with another color.
///
/// If `weight` is 0, the color of `self` is returned. If `weight` is 1, the color
/// of `otherColor` is returned.
///
/// This method works correctly with light and dark mode. A dynamic color is
View gist:dac0b0c6da8b445600aadc6eaca9e942
# If you're using SwiftLint, add this to your swiftlint.yml to make Xcode
# generate warnings when you create new Swift files and Xcode inserts the
# filename where the package name should be.
custom_rules:
# This calls out an Xcode 13 bug where the header comments of newly created
# files include the file name where the package name should be.
xcode_13_header_comment_bug:
regex: ' *\/\/ *([A-Za-z0-9_]*?).swift *\n *\/\/ *\1 *\n'
message: "Incorrect header comment package name"