Skip to content

Commit

Permalink
ソース全体のフォーマットを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
NAOYA-MAEDA-DEV committed Apr 30, 2024
1 parent 61eee1f commit f59b72c
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 219 deletions.
102 changes: 51 additions & 51 deletions CoreNFCSampler/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,61 @@
import SwiftUI

struct ContentView: View {
@StateObject private var reader = NFCTagReader()
@FocusState private var textFieldIsFocused: Bool

var body: some View {
VStack(spacing: 0) {
Text("Scan Result")
.font(.largeTitle)
Text(reader.readMessage ?? "")
Spacer()
if reader.sessionType == .write {
VStack(alignment: .leading) {
Text("Write Message")
TextField(
"Enter the message.",
text: $reader.writeMesage
)
.focused($textFieldIsFocused)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
.padding()
}
if reader.nfcFormat == .ndef {
Picker("Session Type", selection: $reader.sessionType) {
ForEach(SessionType.allCases) { session in
Text(session.rawValue).tag(session)
}
}
.colorMultiply(.accentColor)
.pickerStyle(.segmented)
.padding()
}
Picker("NFC Format", selection: $reader.nfcFormat) {
ForEach(NFCFormat.allCases) { session in
Text(session.rawValue).tag(session)
}
}
.colorMultiply(.accentColor)
.pickerStyle(.segmented)
.padding()
Button(action: {
reader.beginScanning()
}, label: {
Text("Scan")
.frame(width: 200, height: 15)
})
.padding()
.accentColor(Color.white)
.background(Color.accentColor)
.cornerRadius(.infinity)
.disabled(!reader.readingAvailable)
@StateObject private var reader = NFCTagReader()
@FocusState private var textFieldIsFocused: Bool

var body: some View {
VStack(spacing: 0) {
Text("Scan Result")
.font(.largeTitle)
Text(reader.readMessage ?? "")
Spacer()
if reader.sessionType == .write {
VStack(alignment: .leading) {
Text("Write Message")
TextField(
"Enter the message.",
text: $reader.writeMesage
)
.focused($textFieldIsFocused)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
.padding()
}
if reader.nfcFormat == .ndef {
Picker("Session Type", selection: $reader.sessionType) {
ForEach(SessionType.allCases) { session in
Text(session.rawValue).tag(session)
}
}
.colorMultiply(.accentColor)
.pickerStyle(.segmented)
.padding()
}
Picker("NFC Format", selection: $reader.nfcFormat) {
ForEach(NFCFormat.allCases) { session in
Text(session.rawValue).tag(session)
}
}
.colorMultiply(.accentColor)
.pickerStyle(.segmented)
.padding()
Button(action: {
reader.beginScanning()
}, label: {
Text("Scan")
.frame(width: 200, height: 15)
})
.padding()
.accentColor(Color.white)
.background(Color.accentColor)
.cornerRadius(.infinity)
.disabled(!reader.readingAvailable)
}
.padding()
}
}

#Preview {
ContentView()
ContentView()
}
8 changes: 4 additions & 4 deletions CoreNFCSampler/CoreNFCSamplerApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import SwiftUI

@main
struct CoreNFCSamplerApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Loading

0 comments on commit f59b72c

Please sign in to comment.