Skip to content

Commit

Permalink
Merge pull request #2 from NAOYA-MAEDA-DEV/refactor/format
Browse files Browse the repository at this point in the history
ソース全体のフォーマットを修正
  • Loading branch information
NAOYA-MAEDA-DEV authored Apr 30, 2024
2 parents 61eee1f + f59b72c commit e6c7471
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 e6c7471

Please sign in to comment.