Skip to content

Instantly share code, notes, and snippets.

View Jomy10's full-sized avatar

Jonas Everaert Jomy10

View GitHub Profile
@Jomy10
Jomy10 / nodes.swift
Created April 13, 2022 15:36
Graph Search Algorithms in 100 Seconds - And Beyond with Swiftt
#!/usr/bin/env swift
// This is a Swift implementation of Fireship's "Graph Search Algorithms in 100 seconds - And beyond with JS" video
// You can find it here: https://www.youtube.com/watch?v=cWNEl4HE2OE
let airports = "PHX BKK OKC JFK LAX MEX HEL LAP LIM".split(separator: " ")
let routes = [
["PHX", "LAX"],
["PHX", "JFK"],
@Jomy10
Jomy10 / #Useful-Swift-Packages.md
Last active February 2, 2022 15:58
Useful Swift packages

Useful Swift Packages

This is a list of packages that I have used throughout my own projects. Most packages that have something to do with UI are for SwiftUI and if not I'll leave an explanation of how to use them within SwiftUI.

UI

Messages

  • AlertToast
    • Has a beutiful collection of toast messages. Including animated checkmarks, etc. Very easy to use and well documented.

Images

@Jomy10
Jomy10 / # Lightbox in SwiftUI.md
Last active March 1, 2024 07:36
Lightbox in SwiftUI

Lightbox in SwiftUI

This gist shows a wrapper around Lightbox, a convenient and easy to use image viewer for iOS, for SwiftUI.

This gist contains 2 files:

@Jomy10
Jomy10 / rust_in_swift.md
Last active April 4, 2025 23:17
Calling Rust library from Swift code (creating executable)

Calling a Rust library from Swift

This gist shows a quick overview of calling Rust in a Swift project, with Swift Package Manager configured.

Let's go ahead and create a folder containing all our sources:

mkdir swift-rs && cd $_
@Jomy10
Jomy10 / ImageShareSheet.swift
Last active November 11, 2021 21:16
SwiftUI Image Share Sheet
import Foundation
import SwiftUI
/// A view for sharing an image. The user can add the image to their cameraroll, share it via iMessage, etc.
struct ImageShareSheet: UIViewControllerRepresentable {
/// The images to share
let images: [UIImage]
func makeUIViewController(context: Context) -> some UIViewController {
let activityViewController = UIActivityViewController(activityItems: images, applicationActivities: nil)
@Jomy10
Jomy10 / HandleAboutMac.java
Last active January 15, 2022 18:49
This class lets you customise the about menu for Mac users (Java/JavaFX)
// When you call new HandleAboutMac(), it will set the action on what has to be done when a Mac user selects the about menu
// in [your app name] > about [your app name]
public class HandleAboutMac {
public HandleAboutMac() {
com.apple.eawt.Application application = com.apple.eawt.Application.getApplication();
application.setAboutHandler(new AboutHandler() {
@Override
public void handleAbout(AppEvent.AboutEvent aboutEvent) {
// This is where your code goes for what has to be done when a Mac user selects the about menu
// For example: