Skip to content

Commit

Permalink
创建到扬声器阵列的绑定。在预览中创建静态扬声器数据,并将其传递给初始化程序。MeetingFooterView
Browse files Browse the repository at this point in the history
  • Loading branch information
mona-lisa-octo-ue5 committed Jan 6, 2021
1 parent bca5d90 commit 4319661
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
4 changes: 4 additions & 0 deletions SwiftUIPro/SwiftUIPro.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
64F0C3DA25A47428008BE9EA /* DetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F0C3D925A47428008BE9EA /* DetailView.swift */; };
64F0C3DD25A555AB008BE9EA /* EditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F0C3DC25A555AB008BE9EA /* EditView.swift */; };
64F0C3E125A566C9008BE9EA /* MeetingHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F0C3E025A566C9008BE9EA /* MeetingHeaderView.swift */; };
64F0C3E425A588D7008BE9EA /* MeetingFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F0C3E325A588D7008BE9EA /* MeetingFooterView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -46,6 +47,7 @@
64F0C3D925A47428008BE9EA /* DetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailView.swift; sourceTree = "<group>"; };
64F0C3DC25A555AB008BE9EA /* EditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditView.swift; sourceTree = "<group>"; };
64F0C3E025A566C9008BE9EA /* MeetingHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingHeaderView.swift; sourceTree = "<group>"; };
64F0C3E325A588D7008BE9EA /* MeetingFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingFooterView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -87,6 +89,7 @@
64F0C3D925A47428008BE9EA /* DetailView.swift */,
64F0C3DC25A555AB008BE9EA /* EditView.swift */,
64F0C3E025A566C9008BE9EA /* MeetingHeaderView.swift */,
64F0C3E325A588D7008BE9EA /* MeetingFooterView.swift */,
6458AF2225A445140063BFE0 /* Assets.xcassets */,
6458AF2725A445140063BFE0 /* Info.plist */,
6458AF2425A445140063BFE0 /* Preview Content */,
Expand Down Expand Up @@ -190,6 +193,7 @@
64F0C3D125A46077008BE9EA /* MeetingView.swift in Sources */,
64F0C3C825A45803008BE9EA /* AVPlayer+Ding.swift in Sources */,
64F0C3DD25A555AB008BE9EA /* EditView.swift in Sources */,
64F0C3E425A588D7008BE9EA /* MeetingFooterView.swift in Sources */,
6458AF2125A445120063BFE0 /* ContentView.swift in Sources */,
64F0C3BB25A44BEA008BE9EA /* Color+Codable.swift in Sources */,
64F0C3CE25A45D5D008BE9EA /* SpeechRecognizer.swift in Sources */,
Expand Down
Binary file not shown.
29 changes: 29 additions & 0 deletions SwiftUIPro/SwiftUIPro/MeetingFooterView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// MeetingFooterView.swift
// SwiftUIPro
//
// Created by 石玉龙 on 2021/1/6.
//

import SwiftUI

struct MeetingFooterView: View {
@Binding var speakers:[ScrumTimer.Speaker]
var body: some View {
HStack{
Text("Speaker 1 of 3")
Button(action: {}) {
Image(systemName: "forward.fill")
}
.accessibilityLabel(Text("Next speaker"))
}
}
}

struct MeetingFooterView_Previews: PreviewProvider {
static var speakers=[ScrumTimer.Speaker(name: "Kim", isCompleted: false),ScrumTimer.Speaker(name: "Bill", isCompleted: false)]
static var previews: some View {
MeetingFooterView(speakers: .constant(speakers))
.previewLayout(.sizeThatFits)
}
}
10 changes: 7 additions & 3 deletions SwiftUIPro/SwiftUIPro/MeetingHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ struct MeetingHeaderView: View {
secondsRemaining/60
}
private var minutesRemainingMetric: String {
minutesRemaining == 1 ? "minute" : "minutes"
}
minutesRemaining == 1 ? "minute" : "minutes"
}
let scurmColor: Color
var body: some View {
VStack{
ProgressView(value: 5, total: 15)
ProgressView(value: progress)
// .progressViewStyle(ScrumProgressViewStyle(s))

HStack{
VStack(alignment: .leading){
Text("Seconds Elapsed")
Expand All @@ -42,6 +45,7 @@ struct MeetingHeaderView: View {
.accessibilityElement(children: .ignore)
.accessibilityLabel(Text("Time remaining"))
.accessibilityValue(Text("\(minutesRemaining) \(minutesRemainingMetric)"))
.padding([.top,.horizontal])
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions SwiftUIPro/SwiftUIPro/MeetingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
//

import SwiftUI
import AVFoundation

struct MeetingView: View {
@Binding var scrum:DailyScrum
@StateObject var scrumTimer = ScrumTimer()
var body: some View {
ZStack{
RoundedRectangle(cornerRadius: 16.0)
.fill(scrum.color)
VStack{
Circle()
.strokeBorder(lineWidth: 24, antialiased: true)
HStack{
Text("Speaker 1 of 3")
Button(action: {}) {
Image(systemName: "forward.fill")
}
.accessibilityLabel(Text("Next speaker"))
}

}
.padding()
.foregroundColor(scrum.color.accessibleFontColor)
.onAppear{
scrumTimer.reset(lengthInMinutes: scrum.lengthInMinutes, attendees: scrum.attendees)
scrumTimer.startScrum()
}
.onDisappear{
scrumTimer.stopScrum()
}
}
}
}
Expand Down

0 comments on commit 4319661

Please sign in to comment.