mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-22 16:48:37 +02:00
Add projects
This commit is contained in:
60
Examples/SFSymbols/SFSymbols.playground/Contents.swift
Executable file
60
Examples/SFSymbols/SFSymbols.playground/Contents.swift
Executable file
@@ -0,0 +1,60 @@
|
||||
import UIKit
|
||||
import PlaygroundSupport
|
||||
import SwiftUI
|
||||
|
||||
var colors: [Color] = [.red, .blue, .black, .gray, .green, .yellow, .orange, .pink, .purple]
|
||||
|
||||
struct SymbolRow: View {
|
||||
var symbol: String
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Image(systemName: symbol).foregroundColor(colors.randomElement())
|
||||
Divider()
|
||||
Text(symbol)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SymbolDetail: View {
|
||||
var symbol: String
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image(systemName: symbol)
|
||||
.foregroundColor(colors.randomElement())
|
||||
.imageScale(.large)
|
||||
.scaleEffect(3.0)
|
||||
.padding(.bottom, 100)
|
||||
Divider()
|
||||
// .animation(Animation.basic().delay(0.25))
|
||||
Text(symbol).font(.headline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
|
||||
var body: some View {
|
||||
let list = (0..<symbols.count)
|
||||
|
||||
return NavigationView {
|
||||
List(list) { index in
|
||||
NavigationButton(destination: SymbolDetail(symbol: symbols[index])) {
|
||||
SymbolRow(symbol: symbols[index])
|
||||
}
|
||||
}
|
||||
}.navigationBarTitle(Text("SF Symbols"))
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
let contentView = ContentView()
|
||||
PlaygroundPage.current.liveView = UIHostingController(rootView: contentView)
|
||||
1588
Examples/SFSymbols/SFSymbols.playground/Sources/Symbols.swift
Executable file
1588
Examples/SFSymbols/SFSymbols.playground/Sources/Symbols.swift
Executable file
File diff suppressed because it is too large
Load Diff
4
Examples/SFSymbols/SFSymbols.playground/contents.xcplayground
Executable file
4
Examples/SFSymbols/SFSymbols.playground/contents.xcplayground
Executable file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='ios'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
Reference in New Issue
Block a user