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
/* | |
Make sure to compile this with the following flags: | |
-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks | |
*/ | |
extension AsyncIteratorProtocol { | |
func newAndNext() async throws -> (Self, Element)? { |
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
// | |
// AppDelegate.swift | |
// GithubInfo | |
// | |
// Created by Chris Eidhof on 25.06.19. | |
// Copyright © 2019 Chris Eidhof. All rights reserved. | |
// | |
import UIKit | |
import SwiftUI |
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 UIKit | |
// If you enjoyed this talk (video link will be up soon), then you might also enjoy our book Advanced Swift: http://www.objc.io/books/advanced-swift | |
struct Person { | |
let name: String | |
let city: String | |
} | |
let people = [ |
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 | |
import NIO | |
import NIOHTTP1 | |
// Inspired/parts copied from http://www.alwaysrightinstitute.com/microexpress-nio/ | |
final class HelloHandler: ChannelInboundHandler { | |
typealias InboundIn = HTTPServerRequestPart | |
func channelRead(ctx: ChannelHandlerContext, data: NIOAny) { |
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 | |
import MASShortcut | |
func pow() { | |
let rect = NSScreen.mainScreen()?.frame | |
let window = NSWindow(contentRect: rect!, styleMask: NSBorderlessWindowMask, backing: .Buffered, `defer`: false) | |
window.backgroundColor = NSColor.clearColor() | |
window.opaque = false | |
window.alphaValue = 1 | |
window.makeKeyAndOrderFront(NSApplication.sharedApplication()) |
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 SwiftUI | |
struct MyTextEditor: NSViewRepresentable { | |
@Binding var text: String | |
final class Coordinator: NSObject, NSTextViewDelegate { | |
var text: Binding<String> |
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 SwiftUI | |
struct ContentView: View { | |
@State private var toggle = true | |
@Namespace private var ns | |
var body: some View { | |
let box = Rectangle() | |
.fill(.tertiary) |
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 UIKit | |
import SwiftUI | |
struct ContentView2: View { | |
var body: some View { | |
VStack { | |
SimpleRepresentable(text: "Test") | |
} | |
} | |
} |
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 | |
// ExtensibleEffects | |
// | |
// Created by Chris Eidhof on 02.01.18. | |
// Copyright © 2018 objc.io. All rights reserved. | |
// | |
import Foundation |