Skip to content

Instantly share code, notes, and snippets.

View NathanWalker's full-sized avatar

Nathan Walker NathanWalker

View GitHub Profile
@NathanWalker
NathanWalker / README.md
Last active November 13, 2026 18:58
Electron: an accessory view in a message box on macOS with NativeScript (electron/electron#12437)

Electron: an accessory view in a message box on macOS

For electron/electron#12437: dialog.showMessageBox with an accessory view, here a scrollable, selectable, monospaced stack trace with a Copy button.

NativeScript's macOS runtime makes every Objective-C class a global in Electron's main process, and JavaScript classes can subclass them. Nothing to compile, no addon, no patch to Electron.

See it running

On an Apple Silicon Mac with macOS 14.4 or later:

@NathanWalker
NathanWalker / README.md
Last active November 13, 2026 19:04
Electron: a non-activating, keyboard-focusable panel on macOS with NativeScript (electron/electron#52915)

Electron: a non-activating, keyboard-focusable panel on macOS

For electron/electron#52915: a Spotlight-like input panel that takes typing while the app the user was in stays active.

NativeScript's macOS runtime makes every Objective-C class a global in Electron's main process, and JavaScript classes can subclass them. Nothing to compile, no addon, no patch to Electron.

See it running

On an Apple Silicon Mac with macOS 14.4 or later:

@NathanWalker
NathanWalker / ns-mitosis.js
Created November 2, 2026 03:56
Mitosis with NativeScript
const mitosis = require('@builder.io/mitosis');
const fs = require('fs');
const path = require('path');
const sourceCode = fs.readFileSync(
path.resolve(__dirname, './src/components/counter.lite.tsx'),
'utf8'
);
// 1. Parse the Mitosis JSX file into an Abstract Syntax Tree (AST)
@NathanWalker
NathanWalker / README.md
Last active September 28, 2026 17:44
NativeScript - UIKit gestures and an in-process, interruptible spring in TypeScript compared with SwiftUI

NativeScript interruptible animation runs in-process

SwiftUI runs animations in the app process so a touch can interrupt them on any frame. NativeScript's JavaScript already runs on the main thread, so fold-snap.ios.ts below does exactly that in TypeScript.

ns-interruptible-spring-animation.mov

1. Client-side animation

SwiftUI can be "fully interactive and interruptible by the user while it's animating", and UIKit can do the same.

@NathanWalker
NathanWalker / device.util.ts
Last active May 6, 2025 20:27
NativeScript method for getting app version and build info anytime. Works for iOS, Android and even Vision Pro + Meta Quest.
import { Utils } from '@nativescript/core'
export function getAppVersionInfo() {
let versionName: string;
let buildNumber: string;
if (__APPLE__) {
versionName = NSBundle.mainBundle.objectForInfoDictionaryKey('CFBundleShortVersionString');
buildNumber = NSBundle.mainBundle.objectForInfoDictionaryKey('CFBundleVersion');
} else {
const pi = Utils.android
@NathanWalker
NathanWalker / ns-if.directive.ts
Last active May 4, 2024 01:00
nsIf - Specialized NativeScript directive for Angular to optimize view show/hide with change detection under mobile constraints
import {
Directive,
ElementRef,
EmbeddedViewRef,
Input,
OnDestroy,
OnInit,
Optional,
TemplateRef,
ViewContainerRef,
@NathanWalker
NathanWalker / view.component.html
Created September 27, 2023 23:30
iOS 17 variable color symbol effects with NativeScript
<Image [src]="image" stretch="aspectFit" (loaded)="loadedImage($event)" class="w-full h-full"></Image>
@NathanWalker
NathanWalker / @angular-devkit+schematics+16.1.3.patch
Created July 6, 2023 01:56
Nx with SchematicNameCollisionException error patch fix
diff --git a/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js b/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js
index 1d2c59c..9ed0cb1 100755
--- a/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js
+++ b/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js
@@ -137,7 +137,7 @@ class FileSystemEngineHostBase {
const aliases = description.schematics[schematicName].aliases || [];
for (const alias of aliases) {
if (allNames.indexOf(alias) != -1) {
- throw new SchematicNameCollisionException(alias);
+ // throw new SchematicNameCollisionException(alias);
@NathanWalker
NathanWalker / birthday.component.html
Created June 30, 2022 04:15
NativeScript for Angular pipe usage sample
<Label text="The hero's birthday is {{ birthday | date }}"></Label>
@NathanWalker
NathanWalker / birthday.component.html
Created June 30, 2022 04:14
Angular web pipe sample
<p>The hero's birthday is {{ birthday | date }}</p>