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 SnapList: View { | |
private let colors: [Color] = [ | |
.white, .black, .red, .blue, .yellow, .green | |
] | |
var body: some View { | |
ScrollView { | |
LazyVStack(spacing: 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 SwiftUI | |
struct TestShadow: View { | |
var body: some View { | |
VStack { | |
Text("こちらへ") | |
Text("▶") | |
} | |
.padding() | |
.background(.yellow) |
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 TestContainerShape: View { | |
var body: some View { | |
VStack { | |
Text("🐶 Dog") | |
.padding() | |
.background(.yellow) | |
.clipShape(.rect(cornerRadius: 24)) // * |
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 TestSearchTextField: View { | |
@Binding var text: String | |
@FocusState private var focused: Bool | |
var body: some View { | |
VStack { | |
HStack(spacing: 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 SwiftUI | |
struct TestClickEvent: View { | |
var body: some View { | |
VStack { | |
Button("default") { | |
print("clicked.") // OK | |
} |
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 TestDataFlow: View { | |
@State var text = "" | |
@State var isOn = false | |
var stateHolder = StateHolder() | |
var body: some View { |
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 | |
import ServiceManagement | |
// view | |
Toggle( | |
"Launch at login", | |
isOn: Binding( | |
get: { SMAppService.mainApp.isEnabled }, | |
set: { _ in SMAppService.mainApp.toggle() } | |
) |
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 Graph: View { | |
@State var cells: [Cell] = [] | |
private let colors: [Color] = [.clear, .level0, .level1, .level2, .level3, .level4] | |
var body: some View { | |
Grid(horizontalSpacing: 2, verticalSpacing: 2) { | |
ForEach(0 ..< 7, id: \.self) { row in |
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 TestTaskID: View { | |
@State private var text = "" | |
@State private var taskID = UUID() | |
var body: some View { | |
Text("\(text)") | |
.task(id: taskID) { // * | |
let url = URL(string: "https://worldtimeapi.org/api/timezone/Asia/Tokyo.txt")! |
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 TestView: View { | |
@State var id = false | |
var body: some View { | |
AutoProgressView() | |
.padding() | |
.id(id) |