Skip to content

Instantly share code, notes, and snippets.

View mshafer's full-sized avatar

Michael Shafer mshafer

  • Brisbane, Australia
View GitHub Profile
@mshafer
mshafer / LocationSearchService.swift
Last active February 13, 2022 03:47
MKLocalSearchCompleter results in SwiftUI using Combine. More explanation: https://www.mozzafiller.com/posts/mklocalsearchcompleter-swiftui-combine
import Foundation
import SwiftUI
import MapKit
import Combine
class LocationSearchService: NSObject, ObservableObject, MKLocalSearchCompleterDelegate {
@Published var searchQuery = ""
var completer: MKLocalSearchCompleter
@Published var completions: [MKLocalSearchCompletion] = []
var cancellable: AnyCancellable?
@mshafer
mshafer / epub-press-scriptable.js
Created March 22, 2020 01:35
Download webpage as EPUB using the EpubPress client in Scriptable on iOS
/**
* Modified version of epub-press-js (https://github.com/haroldtreen/epub-press-clients/tree/master/packages/epub-press-js)
* which runs in Scriptable on iOS.
*
* Saves an EPUB version of the given URL to an iCloud Drive folder
*
* Expects these Shortcut parameters to be passed in:
* title: string
* description: string
* url: string
@mshafer
mshafer / ContentView.swift
Last active May 3, 2023 13:37
Slide-over card (like in Maps or Stocks) using SwiftUI
import SwiftUI
struct ContentView : View {
var body: some View {
ZStack(alignment: Alignment.top) {
MapView()
SlideOverCard {
VStack {
CoverImage(imageName: "maitlandbay")
Text("Maitland Bay")