💄 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> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <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> <key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
@ -44,29 +68,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </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> </dict>
</plist> </plist>

View File

@ -14,6 +14,29 @@ struct LecturePlanItem: View {
var body: some View { var body: some View {
VStack { 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) Text(event.value(forKey: "summary") as! String)
Button(action: { Button(action: {
event.setValue(!isHidden, forKey: "isHidden") event.setValue(!isHidden, forKey: "isHidden")
@ -30,6 +53,7 @@ struct LecturePlanItem: View {
.foregroundColor(.white) .foregroundColor(.white)
.background(Color.blue) .background(Color.blue)
.cornerRadius(15) .cornerRadius(15)
Spacer()
} }
.onAppear{ .onAppear{
self.isHidden = event.value(forKey: "isHidden") as! Bool 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 { struct LecturePlanItem_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
LecturePlanItem(event: getPreviewEvent()) LecturePlanItem(event: getPreviewEvent())