💄 Changed LectureItem

This commit is contained in:
David Huh 2021-02-07 20:39:56 +01:00
parent 5e177eedd5
commit a3871f87da
2 changed files with 54 additions and 24 deletions

View File

@ -6,6 +6,30 @@
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Alpaca-Alt-Icon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alpaca-alt-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>dhbw-standard-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
@ -44,29 +68,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>dhbw-standard-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Alpaca-Alt-Icon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alpaca-alt-icon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -14,6 +14,29 @@ struct LecturePlanItem: View {
var body: some View {
VStack {
VStack {
Text(event.value(forKey: "summary") as! String)
.font(.title3)
.frame(maxWidth: .infinity, alignment: .leading)
HStack {
VStack(alignment: .leading) {
Text("When")
Text("Where")
}
VStack(alignment: .leading) {
Text(getDateAsString(date: event.value(forKey: "startDate") as! Date) )
.bold()
Text(event.value(forKey: "location") as! String)
.bold()
}.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding()
.background(
RoundedRectangle(cornerRadius: 10)
.fill(Color.gray)
)
Spacer()
Text(event.value(forKey: "summary") as! String)
Button(action: {
event.setValue(!isHidden, forKey: "isHidden")
@ -30,6 +53,7 @@ struct LecturePlanItem: View {
.foregroundColor(.white)
.background(Color.blue)
.cornerRadius(15)
Spacer()
}
.onAppear{
self.isHidden = event.value(forKey: "isHidden") as! Bool
@ -37,6 +61,12 @@ struct LecturePlanItem: View {
}
}
func getDateAsString(date: Date) -> String {
let formatter = DateFormatter()
formatter.dateStyle = .short
return formatter.string(from: date)
}
struct LecturePlanItem_Previews: PreviewProvider {
static var previews: some View {
LecturePlanItem(event: getPreviewEvent())