Skip to content

Instantly share code, notes, and snippets.

@DreamingInBinary
Created July 1, 2021 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DreamingInBinary/c9517adf51aaf23268b731e0dadfcb31 to your computer and use it in GitHub Desktop.
Save DreamingInBinary/c9517adf51aaf23268b731e0dadfcb31 to your computer and use it in GitHub Desktop.
//
// SidebarSearchView.swift
//
// Created by Jordan Morgan on 6/30/21.
//
import SwiftUI
struct SidebarSearchView: NSViewRepresentable {
typealias NSViewType = NSSearchField
func makeNSView(context: Context) -> NSSearchField {
let searchField = NSSearchField(string: "")
searchField.bezelStyle = NSTextField.BezelStyle.roundedBezel
searchField.controlSize = NSControl.ControlSize.large
searchField.translatesAutoresizingMaskIntoConstraints = false
searchField.setContentHuggingPriority(.defaultHigh, for: .vertical)
searchField.setContentHuggingPriority(.defaultHigh, for: .horizontal)
return searchField
}
func updateNSView(_ nsView: NSSearchField, context: Context) {
}
}
struct SidebarSearchView_Previews: PreviewProvider {
static var previews: some View {
SidebarSearchView()
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment