This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original from https://forum.unity3d.com/threads/share-volume-fog-shader.147323/ | |
Shader "Effect/SphereFog" { | |
Properties { | |
_FogColor ("Fog Color", Color) = (1,1,1,1) | |
[space] | |
_Density ("Density", Float) = 1 | |
_Power ("Power/gamma", Float) = 4 | |
_Offset ("Offset", Range(-.1,.1)) = -0.003 | |
[space] | |
_NearbyOffset ("Nearby Offset", Float) = -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// Airdrop Demo | |
// | |
// Created by Daniel Kuntz on 7/30/23. | |
// | |
import SwiftUI | |
struct ContentView: View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CDView.swift | |
// CD | |
// | |
// Created by Daniel Kuntz on 7/3/23. | |
// | |
import SwiftUI | |
struct ShapeWithHole: Shape { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if DEBUG | |
/* | |
This fixes SwiftUI previews not rendering translucent materials correctly by | |
swizzling a couple of properties on NSWindow. | |
Just drop into your project and add to the target being previewed (or something it links against). | |
Notice the #if DEBUG, so this code won't end up in release builds. It also checks for the | |
XCODE_RUNNING_FOR_PREVIEWS environment variable so that it won't affect regular debug builds of the app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to a "Run Script" build phase in your app's main target, as the last step. | |
# It will use the pluginkit command-line tool to force the plugin system on macOS to add your extensions to its database, making them available. | |
# I made this specifically for widgets, but it should work for pretty much any extension type (appex bundle). | |
find $CODESIGNING_FOLDER_PATH -name '*.appex' -exec pluginkit -a {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import Foundation | |
@discardableResult | |
func acquirePrivileges() -> Bool { | |
let accessEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary) | |
if accessEnabled != true { | |
print("You need to enable the keylogger in the System Prefrences") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simplified version of https://gist.github.com/anandabits/d9494d14fef221983ff4f1cafa318d47#file-areequatablyequal-swift | |
func isEqual(x: Any, y: Any) -> Bool { | |
func f<LHS>(_ lhs: LHS) -> Bool { | |
let p = Wrapper<LHS>.self as? AnyEquatable.Type | |
return p?.isEqual(x, y) ?? false | |
} | |
return _openExistential(x, do: f) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomPicker.swift | |
// | |
// Created by T Brennan on 27/3/21. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var selection: Int? = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@available(macOS 10.15, *) | |
extension NSEvent { | |
static func publisher(scope: Publisher.Scope, matching: EventTypeMask) -> Publisher { | |
return Publisher(scope: scope, matching: matching) | |
} | |
public struct Publisher: Combine.Publisher { | |
public enum Scope { | |
case local, global | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension CGRect { | |
fileprivate func point(anchor: UnitPoint) -> CGPoint { | |
var point = self.origin | |
point.x += self.size.width * anchor.x | |
#if os(macOS) | |
point.y += self.size.height * (1 - anchor.y) | |
#else | |
point.y += self.size.height * anchor.y |
NewerOlder