Skip to content

Instantly share code, notes, and snippets.

@Amzd
Amzd / Navigation.swift
Last active July 6, 2023 03:34
Fix the back swipe gesture not working correctly in SwiftUI. https://stackoverflow.com/a/58345554/3393964
/// Fixed swipe gesture NavigationLink
struct NavigationLink<Destination: View, Label:View>: View {
var destination: Destination
var label: () -> Label
public init(destination: Destination, @ViewBuilder label: @escaping () -> Label) {
self.destination = destination
self.label = label
}
@analogpotato
analogpotato / gist:c47794e9a6a7f12a51b71bf3bee6b3cf
Created July 10, 2020 23:12
Using UIViewRepresentable to declare a UIKit Menu from a button
//In your view, declare a UIViewRepresentable as a UIButton type as seen below.
//This is important as you cannot do it as a UIBarButtonItem (at least as I've found in Xcode 12 beta 2).
struct MenuButtonView: UIViewRepresentable {
typealias UIViewType = UIButton
let saveAction = UIAction(title: "") { action in }
let saveMenu = UIMenu(title: "", children: [
@xrq-phys
xrq-phys / MLComputeGEMM.swift
Created December 25, 2020 18:14
Very simple example of an ML Compute matrix multiplication. Naming convention somehow violated.
import Foundation
import MLCompute
import PlaygroundSupport
let iPage = PlaygroundPage.current
iPage.needsIndefiniteExecution = true
/*
* Apple says MLCMatMulLayer does a ``batch matrix multiplication''
* but didn't make clear its meaning.
@pushpendre
pushpendre / pid_control_servers.ipynb
Created July 4, 2021 19:49
PID Controller for controlling the number of servers in a data-center. This notebook accompanies the video https://youtu.be/pKuVUmpYkLk
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yelban
yelban / notes.md
Created August 12, 2021 11:56 — forked from dreness/notes.md
Low Latency HLS test: how low can you go?
@sebjvidal
sebjvidal / ViewController.swift
Created November 4, 2025 09:21
UIGlassContainerEffect-Demo
//
// ViewController.swift
// UIGlassContainerEffect-Demo
//
// Created by Seb Vidal on 04/11/2025.
//
import UIKit
import MapKit