A simple interface for picking SF Symbols in SwiftUI.
SymbolPicker
view (see examples below).Please note, this package may work on previous versions of the following technologies; however, there is no consideration made to support versions earlier than stated below (breaking change may be made at any time).
This package can be installed either through the Xcode GUI, or you can add it manually to your Package.swift file:
dependencies: [
.package(url: "https://github.com/codydlewis/SymbolPicker.git", .upToNextMajor(from: "1.0.0"))
]
It is recommended to use SymbolPicker
within a sheet
.
import SwiftUI
import SymbolPicker
struct ContentView: View {
@State private var symbol = "folder"
@State private var showSymbolPicker = false
var body: some View {
Button {
showSymbolPicker.toggle()
} label: {
Label("Select symbol", systemImage: symbol)
}
.sheet(isPresented: $showSymbolPicker) {
SymbolPicker(symbol: $symbol, defaultSymbol: "folder")
}
}
}
You can also create a custom SymbolGroup
and pass that into the view to show a customised subset of symbols.
import SwiftUI
import SymbolPicker
let DocsGroup = SymbolGroup("Documents", symbols: [
"doc", "doc.fill", "doc.circle", "doc.circle.fill", "doc.badge.plus", "doc.fill.badge.plus",
"doc.badge.arrow.up", "doc.badge.arrow.up.fill", "doc.badge.ellipsis", "doc.fill.badge.ellipsis",
"doc.badge.gearshape", "doc.badge.gearshape.fill", "lock.doc", "lock.doc.fill", "arrow.up.doc",
"arrow.up.doc.fill", "arrow.down.doc", "arrow.down.doc.fill", "doc.text", "doc.text.fill",
"doc.zipper", "doc.on.doc", "doc.on.doc.fill", "doc.on.clipboard", "arrow.right.doc.on.clipboard",
"arrow.up.doc.on.clipboard", "arrow.triangle.2.circlepath.doc.on.clipboard", "doc.on.clipboard.fill",
"clipboard", "clipboard.fill", "list.bullet.clipboard", "list.bullet.clipboard.fill",
"list.clipboard", "list.clipboard.fill", "doc.richtext", "doc.richtext.fill", "doc.plaintext",
"doc.plaintext.fill", "doc.append", "doc.append.fill", "doc.text.below.ecg",
"doc.text.below.ecg.fill", "chart.bar.doc.horizontal", "chart.bar.doc.horizontal.fill",
"list.bullet.rectangle.portrait", "list.bullet.rectangle.portrait.fill", "doc.text.magnifyingglass",
])
struct ContentView: View {
@State private var symbol = "doc"
@State private var showSymbolPicker = false
var body: some View {
Button {
showSymbolPicker.toggle()
} label: {
Label("Select symbol", systemImage: symbol)
}
.sheet(isPresented: $showSymbolPicker) {
SymbolPicker(symbol: $symbol, defaultSymbol: "doc", symbolGroup: DocsGroup)
}
}
}
The following is a list of things I would like to do at some point.
This package is available under the MIT license. See the LICENSE file for more information.
link |
Stars: 1 |
Last commit: 4 weeks ago |
Bug fixes:
DefaultSymbols
as public to use outside package.Documentation:
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics