This file contains hidden or 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 | |
| class FlippedView: NSView { | |
| override var isFlipped: Bool { | |
| return true | |
| } | |
| } | |
| private class Spacer: NSView { | |
| var height: CGFloat = 0 |
This file contains hidden or 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 | |
| class FlippedView: NSView { | |
| override var isFlipped: Bool { | |
| return true | |
| } | |
| } | |
| class ViewController: NSViewController { | |
| let items = Array(0..<50).map { String($0) } |
This file contains hidden or 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 | |
| class FlippedView: NSView { | |
| override var isFlipped: Bool { | |
| return true | |
| } | |
| } | |
| class ViewController: NSViewController { | |
| let items = Array(0..<3).map { String($0) } |
This file contains hidden or 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
| class FlippedView: NSView { | |
| override var isFlipped: Bool { | |
| return true | |
| } | |
| } |
This file contains hidden or 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 | |
| class ViewController: NSViewController { | |
| let items = Array(0..<30).map { String($0) } | |
| private var scrollView: NSScrollView! | |
| override func loadView() { | |
| self.view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 300)) | |
| } |
This file contains hidden or 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 | |
| class ViewController: NSViewController { | |
| let items = Array(0..<3).map { String($0) } | |
| override func loadView() { | |
| self.view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 300)) | |
| } | |
| override func viewDidLoad() { |
This file contains hidden or 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 AnyNSViewWrapper { | |
| func getView() -> NSView | |
| } | |
| // Concrete wrapper for specific NSView types | |
| struct NSViewWrapper<Content: NSView>: AnyNSViewWrapper { | |
| let content: Content | |
| func getView() -> NSView { | |
| return content |
This file contains hidden or 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 NSTableViewWrapper: NSViewRepresentable { | |
| class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { | |
| var parent: NSTableViewWrapper | |
| init(parent: NSTableViewWrapper) { | |
| self.parent = parent | |
| } |
This file contains hidden or 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 | |
| func createMessageData(_ messsagePayload: [Int]) -> String { | |
| let encoder = JSONEncoder() | |
| let data = try! encoder.encode(messsagePayload) | |
| let messsagePayloadString = String(data: data, encoding: .utf8)! | |
| return String(messsagePayloadString) | |
| } |
This file contains hidden or 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 SafariServices | |
| import SwiftUI | |
| struct Popover: View { | |
| @State private var content = "" | |
| var body: some View { | |
| VStack(spacing: 16) { | |
| Text("URL") | |
| .font(.headline) |