Skip to content

Instantly share code, notes, and snippets.

View OskarGroth's full-sized avatar

Oskar Groth OskarGroth

View GitHub Profile
@OskarGroth
OskarGroth / ContentView.swift
Created November 1, 2020 21:19
SwiftUI Vibrancy
import SwiftUI
@main
struct DemoVibrancyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State var flip = false
var body: some View {
VStack {
Toggle("Refresh", isOn: $flip)
.toggleStyle(.switch)
StateSubView(model: .init(source: "State subview"))
ObservedSubView(model: .init(source: "Observed subview"))
}
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")
})
import SwiftUI
public struct MouseTrackingView: View {
public var callbacks: NSMouseTrackingView.Callbacks
public var isEnabled: Bool
public var options: NSTrackingArea.Options
public var hitEnabled: Bool
public var flipYAxis: Bool
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
struct ContentView: View {
@State var selected: Bool = false
var body: some View {
Color.clear
.frame(width: 900, height: 400)
.toolbar {
ToolbarItem {
Button(action: {}, label: {
import SwiftUI
@main
struct SwiftApp: App {
@State var someState = false
var body: some Scene {
WindowGroup {
Rectangle()
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([
struct ContentView: View {
var body: some View {
VStack {
StateViewA()
StateViewB()
StateViewC()
StateViewD()
}
}
}
-------------------------------------
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]