This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am helje5 on github. | |
* I am helge (https://keybase.io/helge) on keybase. | |
* I have a public key whose fingerprint is F122 BE44 B11D 97AC B1A2 3231 1809 11CB 8B32 F5FA | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NSDictionaryOfVariableBindings for Swift | |
* | |
* In Objective-C you could use macros to quickly get a Dictionary of views, | |
* keyed on their names in the sourcecode. Like so: | |
* | |
* UILabel *label = [UILabel autolayoutView]; | |
* NSDictionary *views = NSDictionaryOfVariableBindings(label); | |
* | |
* Which you could then use in, for example, VFL: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.swift | |
// TestRecursiveNSArchive | |
// | |
// Created by Helge Hess on 09.12.17. | |
// Copyright © 2017 ZeeZide GmbH. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// https://github.com/apple/swift/blob/master/docs/ABI/KeyPaths.md | |
// https://bugs.swift.org/browse/SR-5689 | |
public struct KeyPathMirror<T: AnyKeyPath> : CustomStringConvertible { | |
public let subject : T | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol BaseProtocol { | |
func doIt() | |
} | |
protocol DerivedProtocol : BaseProtocol { | |
func hello() | |
} | |
class MyObject: DerivedProtocol { | |
func doIt() { print("doIt") } | |
func hello() { print("hello") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MyArray<Element> : CustomStringConvertible { | |
class Storage<T> { | |
var values = ContiguousArray<T>() | |
} | |
var storage = Storage<Element>() | |
init<T: Sequence>(contentsOf s: T) where T.Element == Element { | |
for item in s { storage.values.append(item) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
final class TestView : NSView { | |
static func makeAndAttachToView(_ rootView: NSView) { | |
let view = TestView() | |
view.translatesAutoresizingMaskIntoConstraints = false | |
rootView.addSubview(view) | |
NSLayoutConstraint.activate([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
@IBOutlet weak var window : NSWindow! | |
@IBOutlet weak var tableView : NSTableView! | |
func applicationDidFinishLaunching(_ aNotification: Notification) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift sh | |
import cows // @AlwaysRightInstitute ~> 1.0.0 | |
import SwiftBlocksUI // @SwiftBlocksUI ~> 0.8.0 | |
dotenv.config() | |
struct CowMessage: Blocks { | |
@Environment(\.messageText) private var query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift sh | |
import SwiftBlocksUI // @SwiftBlocksUI ~> 0.8.0 | |
dotenv.config() | |
struct ClipItForm: Blocks { | |
@State(\.messageText) var messageText | |
@State var importance = "medium" |
OlderNewer