NSToolbar (Mac API) UIWindowScene.titlebar.toolbar — access
func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
// setup the window
// Used to detect specific issue with JSON decoding | |
func decodeOrReport(data: Data) { | |
do { | |
let _ = try JSONDecoder().decode(WidgetResponse.self, from: data) | |
print("\n\n👍ALL GOOD\n\n") | |
} catch DecodingError.keyNotFound( let key, let context) { | |
print("\n\n⛔️FAILED TO DECODE\n\n") | |
print("could not find key \(key) in JSON: \(context.debugDescription)") | |
} catch DecodingError.valueNotFound( let type, let context) { | |
print("\n\n⛔️FAILED TO DECODE\n\n") |
// | |
// View+WindowGeometryPreferences.swift | |
// | |
// Created by Drew Olbrich on 1/30/24. | |
// Copyright © 2024 Lunar Skydiving LLC. All rights reserved. | |
// | |
// MIT License | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
import simd | |
/// Creates a 4x4 matrix that orients the +Z axis in the direction of `at`, and the | |
/// +Y axis toward `up`. | |
func simd_look(at: SIMD3<Float>, up: SIMD3<Float> = SIMD3<Float>(0, 1, 0)) -> simd_float4x4 { | |
let zAxis = normalize(at) | |
let xAxis = normalize(cross(up, zAxis)) | |
let yAxis = normalize(cross(zAxis, xAxis)) | |
return simd_float4x4( |
import SWBShared2 | |
import Metal | |
import AppKit | |
import CoreImage | |
import CoreGraphics | |
import QuartzCore | |
@globalActor | |
public struct CALayerToMetalRendererActor { |
extension View { | |
func minimumPadding(edges: Edge.Set = .all, _ length: CGFloat = 8) -> some View { | |
GeometryReader { geo in | |
padding(.bottom, edges.contains(.bottom) ? max(length, geo.safeAreaInsets.bottom) : 0) | |
.padding(.top, edges.contains(.top) ? max(length, geo.safeAreaInsets.top) : 0) | |
.padding(.leading, edges.contains(.leading) ? max(length, geo.safeAreaInsets.leading) : 0) | |
.padding(.trailing, edges.contains(.trailing) ? max(length, geo.safeAreaInsets.trailing) : 0) | |
.ignoresSafeArea(edges: edges) | |
} | |
} |
Create a Swift Command Line Tool in Xcode. You can then copy and paste the below code into the .swift
and .metal
files respectively
main.swift
// | |
// TYAudioVideoManager.swift | |
// Yash Thaker | |
// | |
// Created by Yash Thaker on 05/12/18. | |
// Copyright © 2018 Yash Thaker. All rights reserved. | |
// | |
/* | |
1) mergeVideos(videoUrls: [URL], exportUrl: URL, preset: String? = nil, progress: @escaping Progress, completion: @escaping Completion) |