Skip to content

Instantly share code, notes, and snippets.

Avatar

Oskar Groth OskarGroth

View GitHub Profile
View hopper.crash
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: Hopper Disassembler v4 [6257]
Path: /Applications/Hopper Disassembler v4.app/Contents/MacOS/Hopper Disassembler v4
Identifier: com.cryptic-apps.hopper-web-4
Version: 4.8.2 (4.8.2)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
View gist:960e20e73e0a45a536403fe063bd5a0b
//
// ContentView.swift
// AppleLogo
//
// Created by Oskar Groth on 2021-06-17.
//
import SwiftUI
struct ContentView: View {
View hopper.crash
Process: Hopper Disassembler v4 [5343]
Path: /Applications/Hopper Disassembler v4.app/Contents/MacOS/Hopper Disassembler v4
Identifier: com.cryptic-apps.hopper-web-4
Version: 4.7.3 (4.7.3)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2021-06-10 13:37:03.5151 +0200
View StatusBug.swift
import Cocoa
import SwiftUI
@main
struct StatusBugApp: App {
@StateObject var coordinator = StatusCoordinator()
var body: some Scene {
View SwiftApp.swift
import SwiftUI
@main
struct SwiftApp: App {
@State var someState = false
var body: some Scene {
WindowGroup {
Rectangle()
View HighlightTappable.swift
struct ContentView: View {
var body: some View {
Image(nsImage: NSImage(named: .init(NSImage.applicationIconName))!)
.resizable()
.frame(width: 100, height: 100)
.tapWithHighlight(onTap: {
print("Tap")
}, onLongPress: {
print("Long Press")
})
View SwiftUIStatusItem.swift
import SwiftUI
class Coordinator: ObservableObject {
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
init() {
let view = NSHostingView(rootView: Text("Hello from SwiftUI").fixedSize())
item.button?.addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
View WindowAccessor.swift
import Cocoa
import SwiftUI
public extension View {
func bindWindow(_ window: Binding<NSWindow?>) -> some View {
return background(WindowAccessor(window))
}
}
public struct WindowAccessor: NSViewRepresentable {
View ContentView.swift
class ObjA {
var isOn = false
}
struct ContentView: View {
// Because this is not an observed object, the UI in this view should theoretically never update
let obj = ObjA()
var body: some View {
View ContentView.swift
import SwiftUI
@main
struct DemoVibrancyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}