Skip to content

Instantly share code, notes, and snippets.

@johnno1962
johnno1962 / InjectionInjection.md
Last active November 23, 2022 02:58
Injection Injection

InjectionIII is an app available that provides "code injection" functionality allowing you to update the implementation of functions, memeber function and SwiftUI content body properties without having to restart your application. This can be useful to iterate over code or design without having to rebuild and restart your application continuously.

https://github.com/johnno1962/InjectionIII

Part of the implementation of injection is that it requires a user to add the following line somewhere in their code:

Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
@johnno1962
johnno1962 / swiftui.swift
Last active November 6, 2019 23:51
SwiftUI Injection
// First, install InjectionIII.app from the Mac AppStore
// https://apps.apple.com/us/app/injectioniii/id1380446739?mt=12
// Make these changes to your code:
// add the following to application(didFinishLaunchingWithOptions:)
#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
#endif
@johnno1962
johnno1962 / k.diff
Last active October 23, 2018 19:42
diff --git a/include/swift/AST/KnownIdentifiers.def b/include/swift/AST/KnownIdentifiers.def
index 5222c7f12e..6f6b921841 100644
--- a/include/swift/AST/KnownIdentifiers.def
+++ b/include/swift/AST/KnownIdentifiers.def
@@ -145,6 +145,7 @@ IDENTIFIER(nilLiteral)
IDENTIFIER(integerLiteral)
IDENTIFIER_(builtinIntegerLiteral)
IDENTIFIER(codepointLiteral)
+IDENTIFIER(characterLiteral)
IDENTIFIER_(MaxBuiltinFloatType)
@johnno1962
johnno1962 / raw.md
Last active July 2, 2018 12:21 — forked from erica/oldraw.md
case '"':
return lexStringLiteral(Token::StringModifiers(0));
case '\'':
return lexChar();
case '`':
return lexEscapedIdentifier();
}
}
void Lexer::lexChar() {
let bookTuples = [(1, "john", "book", "novel", 9.99, ["chapt1", "chapt2"]),
(2, "john", "book", "novel", 9.99, ["chapt1", "chapt2"])]
// leaves blank line when there are no values in the list
let json1 = """
{
"catalog": [
\(bookTuples.map {
(id, author, title, genre, price, chapters) in """
{
@johnno1962
johnno1962 / multiline.swift
Last active May 9, 2016 11:11
Multi-line String Zoo
// Multi-line string proposals
// https://github.com/apple/swift/pull/2275
// swift-evolution thread:
// http://thread.gmane.org/gmane.comp.lang.swift.evolution/904/focus=15133
// These examples should load in the prototype toolchain available here:
// http://johnholdsworth.com/swift-LOCAL-2016-05-09-a-osx.tar.gz