Skip to content

Instantly share code, notes, and snippets.

@agiletortoise
agiletortoise / example.swift
Created August 24, 2023 18:56
Intent Dependency
// create an object to inject
struct AppIntentDependencyManager {
func hello() {}
// whatever methods you need....
}
// in didFinishLaunching or similar inject your dependency like...
if #available(iOS 16.0, *) {
AppDependencyManager.shared.add(key: "AppIntentDependencyManager", dependency: AppIntentDependencyManager())
@agiletortoise
agiletortoise / view+background.swift
Created July 31, 2023 16:13
Useful way to provide backward compatible widget backgrounds
extension View {
@ViewBuilder
func widgetBackground<V>(@ViewBuilder content: () -> V) -> some View where V : View {
if #available(macOSApplicationExtension 14.0, iOSApplicationExtension 17.0, *) {
containerBackground(for: .widget) {
content()
}
} else {
background {
content()
@agiletortoise
agiletortoise / content.md
Created May 6, 2020 14:03
Gist from Drafts

This is bold test.

@agiletortoise
agiletortoise / fileName
Created May 6, 2020 13:58
Gist from Drafts
This **is bold** test.
@agiletortoise
agiletortoise / content.md
Created May 6, 2020 13:46
Gist from Drafts

This is bold test.

var pathForContextualMenuPointer: UIBezierPath {
let combinedShape = UIBezierPath()
combinedShape.move(to: CGPoint(x: 12.5, y: 0))
combinedShape.addCurve(to: CGPoint(x: 25, y: 12.5), controlPoint1: CGPoint(x: 19.4, y: 0), controlPoint2: CGPoint(x: 25, y: 5.6))
combinedShape.addLine(to: CGPoint(x: 25, y: 12.5))
combinedShape.addLine(to: CGPoint(x: 25, y: 23.01))
combinedShape.addCurve(to: CGPoint(x: 23.02, y: 25), controlPoint1: CGPoint(x: 25, y: 24), controlPoint2: CGPoint(x: 24, y: 25))
combinedShape.addLine(to: CGPoint(x: 23.02, y: 25))
combinedShape.addLine(to: CGPoint(x: 12.5, y: 25))
@agiletortoise
agiletortoise / PointerEnabledButton.swift
Created March 24, 2020 20:00
PointerEnabledButton class demonstrating pointer support for iPadOS 13.4
import UIKit
class PointerEnabledButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
if #available(iOSApplicationExtension 13.4, *) {
enablePointer()
}
}
@agiletortoise
agiletortoise / GitHub Style.html
Created March 29, 2019 15:33
Example preview template for Drafts for Mac. Place file in /iCloud Drive/Drafts/Library/Templates to make it available.
<html>
<!--
Based on https://github.com/sindresorhus/github-markdown-css
-->
<head>
<style>
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9g
@agiletortoise
agiletortoise / grammar-markdown.json
Created February 17, 2019 21:09
Drafts Markdown Def File
{
"name": "Markdown",
"description": "Basic Markdown syntax based more closely on the original Markdown specification.",
"scopeName": "text.markdown",
"rangeExtension": "lineExtended",
"listCompletion": "markdown",
"fileExtensions": [
"markdown",
"mkdown",
"md",
@agiletortoise
agiletortoise / drafts-5-4-notes.md
Created September 11, 2018 19:18
Drafts 5.4 Release Notes Draft

Drafts 5.4 Release Notes Draft

Siri & Shortcuts Support

  • "Run Shortcut" action step. Pass text to the Shortcuts app and trigger a Shortcut by name with a single tap. This is the same functionality available in the "Run Workflow" action step, updated for the new Shortcuts app.
  • Siri Intents:
    • "Capture clipboard" Siri shortcut. This shortcut allows capture of the current clipboard content to a new draft in Drafts without launching the app.
    • "View draft" Siri Shortcut. Allows creation of a shortcut which displays the content of a specific draft in the Siri interface - with the ability to tap and open that draft in the app. Great for previewing lists, or regularly view reference notes.
  • "Add to Siri" buttons to create voice shortcuts to functions in Drafts directly in the app in the following locations (iOS 12 only):
    • Add shortcut to open a specific draft in the (i) detail view.