NetNewsWire/Multiplatform/macOS/MacSearchField.swift
Stuart Breckenridge 8b7940492a Mac Toolbar
Placement of buttons is not quite right, but the search bar is in the right place!
2020-06-29 21:19:51 +08:00

50 lines
900 B
Swift

//
// MacSearchField.swift
// Multiplatform macOS
//
// Created by Stuart Breckenridge on 29/6/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import AppKit
import SwiftUI
final class MacSearchField: NSViewRepresentable {
typealias NSViewType = NSSearchField
func makeNSView(context: Context) -> NSSearchField {
let searchField = NSSearchField()
searchField.delegate = context.coordinator
return searchField
}
func updateNSView(_ nsView: NSSearchField, context: Context) {
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: NSObject, NSSearchFieldDelegate {
var parent: MacSearchField
init(_ parent: MacSearchField) {
self.parent = parent
}
func searchFieldDidStartSearching(_ sender: NSSearchField) {
//
}
func searchFieldDidEndSearching(_ sender: NSSearchField) {
//
}
}
}