diff --git a/Nemulert/Component/ConnectionStateView.swift b/Nemulert/Component/ConnectionStateView.swift new file mode 100644 index 0000000..5520eeb --- /dev/null +++ b/Nemulert/Component/ConnectionStateView.swift @@ -0,0 +1,26 @@ +// +// ConnectionStateView.swift +// Nemulert +// +// Created by 細田彩香 on 2026/01/19. +// + +import SwiftUI + +struct ConnectionStateView: View { + let isConnected: Bool + + var body: some View { + Image(systemName: "airpods.pro") + .resizable() + .foregroundColor(isConnected ? .primary : .red) + .frame(width: 130, height: 80) + } +} + +#Preview { + VStack { + ConnectionStateView(isConnected: true) + ConnectionStateView(isConnected: false) + } +} diff --git a/Nemulert/Screen/DetectingScreen.swift b/Nemulert/Screen/DetectingScreen.swift index da51950..f8bce13 100644 --- a/Nemulert/Screen/DetectingScreen.swift +++ b/Nemulert/Screen/DetectingScreen.swift @@ -12,23 +12,26 @@ struct DetectingScreen: View { @State private var model = DetectingModel() var body: some View { - LottieView(name: "Nemulert") - .padding() - .onAppear { - model.onAppear() - } - .onChange(of: scenePhase) { oldPhase, newPhase in - switch (oldPhase, newPhase) { - case (.inactive, .active), (.background, .active): - Task { - await model.onSceneChanged() + VStack{ + LottieView(name: "Nemulert") + .padding() + .onAppear { + model.onAppear() + } + .onChange(of: scenePhase) { oldPhase, newPhase in + switch (oldPhase, newPhase) { + case (.inactive, .active), (.background, .active): + Task { + await model.onSceneChanged() + } + + default: + break } - default: - break } - - } + ConnectionStateView(isConnected: model.isConnected) + } } }