diff --git a/CS342Application.xcodeproj/project.pbxproj b/CS342Application.xcodeproj/project.pbxproj index 9f693d8..960274e 100644 --- a/CS342Application.xcodeproj/project.pbxproj +++ b/CS342Application.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 653A255528338800005D4D48 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 653A255428338800005D4D48 /* Assets.xcassets */; }; 653A256228338800005D4D48 /* CS342ApplicationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653A256128338800005D4D48 /* CS342ApplicationTests.swift */; }; B69E935C297BDB100077D617 /* KatieLiu in Frameworks */ = {isa = PBXBuildFile; productRef = B69E935B297BDB100077D617 /* KatieLiu */; }; + B6DFB7F4297F62B700916477 /* KatieLiu.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6DFB7F3297F62B700916477 /* KatieLiu.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -59,6 +60,7 @@ 653A256128338800005D4D48 /* CS342ApplicationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CS342ApplicationTests.swift; sourceTree = ""; }; 653A256728338800005D4D48 /* CS342ApplicationUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CS342ApplicationUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 653A258928339462005D4D48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B6DFB7F3297F62B700916477 /* KatieLiu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KatieLiu.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -110,6 +112,7 @@ 2F23F6B329700C7F003FECF4 /* MemberViews */ = { isa = PBXGroup; children = ( + B6DFB7F3297F62B700916477 /* KatieLiu.swift */, 2FC8A09E297A34C900479145 /* OliverAalami.swift */, 2F23F6B129700C7B003FECF4 /* PaulSchmiedmayer.swift */, ); @@ -361,6 +364,7 @@ 2FC8A09F297A34C900479145 /* OliverAalami.swift in Sources */, 2F23F6AE296FFBAA003FECF4 /* InstructorsUITests.swift in Sources */, 2FC8A09D297A34C300479145 /* LeadsUITests.swift in Sources */, + B6DFB7F4297F62B700916477 /* KatieLiu.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/CS342ApplicationUITests/InstructorsUITests.swift b/CS342ApplicationUITests/InstructorsUITests.swift index 3c57127..7c95cbc 100644 --- a/CS342ApplicationUITests/InstructorsUITests.swift +++ b/CS342ApplicationUITests/InstructorsUITests.swift @@ -15,7 +15,7 @@ class InstructorsUITests: XCTestCase { continueAfterFailure = false } - func testInstructors() throws { + func testInstructors() throws { let app = XCUIApplication() app.launch() diff --git a/CS342ApplicationUITests/MemberViews/KatieLiu.swift b/CS342ApplicationUITests/MemberViews/KatieLiu.swift new file mode 100644 index 0000000..5d460e0 --- /dev/null +++ b/CS342ApplicationUITests/MemberViews/KatieLiu.swift @@ -0,0 +1,36 @@ +// +// This source file is part of the CS342 2023 Application project +// +// SPDX-FileCopyrightText: 2023 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import XCTest + + +class KatieLiu: XCTestCase { + override func setUpWithError() throws { + try super.setUpWithError() + continueAfterFailure = false + } + + func testKatieLiu() throws { + let app = XCUIApplication() + app.launch() + + app.collectionViews.buttons["Katie Liu"].tap() + XCTAssert(app.staticTexts["Katie Liu"].waitForExistence(timeout: 0.5)) + + app.buttons["More About Me"].tap() + XCTAssert(app.staticTexts["Some Favorites"].waitForExistence(timeout: 0.5)) + + XCTAssert(app.buttons["Morning Drink"].waitForExistence(timeout: 0.5)) + XCTAssert(app.buttons["Pittsburgh"].waitForExistence(timeout: 0.5)) + XCTAssert(app.buttons["Evening Snack"].waitForExistence(timeout: 0.5)) + + app.buttons["Morning Drink"].tap() + + app.buttons["Pittsburgh"].tap() + } +} diff --git a/CS342MemberViews/Package.swift b/CS342MemberViews/Package.swift index e191f37..d8a0c62 100644 --- a/CS342MemberViews/Package.swift +++ b/CS342MemberViews/Package.swift @@ -1,5 +1,4 @@ // swift-tools-version: 5.7 - // // This source file is part of the CS342 2023 Application project // @@ -10,7 +9,6 @@ import PackageDescription - let package = Package( name: "CS342MemberViews", platforms: [ @@ -57,8 +55,8 @@ let package = Package( .target(name: "InstructorViews") ], exclude: [ - "Resources/KatieLiu.jpg.license", - "Resources/KatieLiuBio.md.license" + "Resources/KatieLiu.jpeg.license.txt", + "Resources/KatieLiuBio.md.license.txt" ], resources: [ .process("Resources") diff --git a/CS342MemberViews/Sources/InstructorViews/DescriptionView.swift b/CS342MemberViews/Sources/InstructorViews/DescriptionView.swift index 9a1e1d0..6e858ea 100644 --- a/CS342MemberViews/Sources/InstructorViews/DescriptionView.swift +++ b/CS342MemberViews/Sources/InstructorViews/DescriptionView.swift @@ -14,8 +14,7 @@ public struct DescriptionView: View { private let name: String private let title: String private let description: LocalizedStringKey - - + public var body: some View { VStack(spacing: 8) { Text(name) diff --git a/CS342MemberViews/Sources/KatieLiu/KatieLiu.swift b/CS342MemberViews/Sources/KatieLiu/KatieLiu.swift index a0891f0..36d4fc5 100644 --- a/CS342MemberViews/Sources/KatieLiu/KatieLiu.swift +++ b/CS342MemberViews/Sources/KatieLiu/KatieLiu.swift @@ -5,6 +5,9 @@ // // SPDX-License-Identifier: MIT // +// Citations: Open Website in Safari by Sean Allen, +// Tanaschita, Customizing Appearance of Navigation View +// import InstructorViews import SwiftUI @@ -13,23 +16,49 @@ import SwiftUI public struct KatieLiu: View { @Binding var navigationPath: NavigationPath + /*var platforms: [Platform] = [.init(name: "Hello", imageName: "KatieLiu.jpeg", color: .systemGreen) ]*/ public var body: some View { ScrollView(.vertical) { - VStack(spacing: 42) { + VStack(spacing: 30) { ProfileView(profileImage: Bundle.module.image(fromFileNamed: "KatieLiu")) DescriptionView( name: "Katie Liu", title: "B.S. Computer Science and Music", description: Bundle.module.markdown(fromFileNamed: "KatieLiuBio") ) - // TwitterUsername() + Button { + navigationPath.append(KatieLiuDests.moreinfo) + } label: { + Text("More About Me") + .bold() + .frame(width: 280, height: 50) + .foregroundColor(.white) + .buttonStyle(.bordered) + .background( + LinearGradient( + gradient: Gradient( + colors: [Color(.systemGreen), Color(.systemBrown), Color(.systemOrange)] + ), + startPoint: .leading, + endPoint: .trailing + ) + ) + + .cornerRadius(12) + } + } + .navigationDestination(for: KatieLiuDests.self) { destination in + switch destination { + case .moreinfo: + KatieLiuView() + } } - } .navigationTitle("Katie") + .toolbarBackground(Color.green.opacity(0.1), for: .navigationBar) + } } - - + public init(navigationPath: Binding) { self._navigationPath = navigationPath } diff --git a/CS342MemberViews/Sources/KatieLiu/KatieLiuDest.swift b/CS342MemberViews/Sources/KatieLiu/KatieLiuDest.swift new file mode 100644 index 0000000..0aeee88 --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/KatieLiuDest.swift @@ -0,0 +1,18 @@ +// +// File.swift +// +// +// Created by Katie Liu on 1/24/23. +// + +import Foundation +import SwiftUI + +enum KatieLiuDests: String, Identifiable { + case moreinfo + + + var id: String { + rawValue + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/KatieLiuView.swift b/CS342MemberViews/Sources/KatieLiu/KatieLiuView.swift new file mode 100644 index 0000000..aeab839 --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/KatieLiuView.swift @@ -0,0 +1,76 @@ +// +// File.swift +// +// +// Created by Katie Liu on 1/24/23. +// + +import Foundation +import SwiftUI + +struct KatieLiuView: View { + init() { + UISegmentedControl.appearance().selectedSegmentTintColor = .brown + UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.white], for: .selected) + } + + @State private var selectedSide: WhichFact = .tofu + + var body: some View { + NavigationView { + VStack { + Picker("Food and Fall", selection: $selectedSide) { + ForEach(WhichFact.allCases, id: \.self) { + Text($0.rawValue) + } + } + .pickerStyle(SegmentedPickerStyle()) + .padding() + + Spacer() + CappucinoView(selectedSide: selectedSide) + Spacer() + } + .navigationTitle("Some Favorites") + } + } +} + +enum WhichFact: String, CaseIterable { + case tofu = "Evening Snack" + case place = "Home" + case cappucino = "Morning Drink" + var id: String { + rawValue + } +} + +struct CappucinoView: View { + var selectedSide: WhichFact + var body: some View { + switch selectedSide { + case .tofu: + Bundle.module.image(fromFileNamed: "Tofu", type: "jpg") + case .place: + Bundle.module.image(fromFileNamed: "Pittsburgh", type: "jpg") + case .cappucino: + Bundle.module.image(fromFileNamed: "Cappucino", type: "jpg") + } + } +} + +struct TofuImageView: View { + var body: some View { + Bundle.module.image(fromFileNamed: "Tofu", type: "jpg") + .resizable() + .frame(width: 250, height: 400) + .shadow(color: .white, radius: 100) + } +} + +struct MoreInfoView: PreviewProvider { + static var previews: some View { + KatieLiuView() + .preferredColorScheme(.light) + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/Contents.json b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/Contents.json new file mode 100644 index 0000000..adb009b --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "how-to-make-cappuccino-005.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/how-to-make-cappuccino-005.jpg b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/how-to-make-cappuccino-005.jpg new file mode 100644 index 0000000..a674cfe Binary files /dev/null and b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Cappucino.imageset/how-to-make-cappuccino-005.jpg differ diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Contents.json b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/Contents.json b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/Contents.json new file mode 100644 index 0000000..44466c8 --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "pittsburgh-fall-foliage.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/pittsburgh-fall-foliage.jpg b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/pittsburgh-fall-foliage.jpg new file mode 100644 index 0000000..4d2a234 Binary files /dev/null and b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Pittsburgh.imageset/pittsburgh-fall-foliage.jpg differ diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/Contents.json b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/Contents.json new file mode 100644 index 0000000..fe275cb --- /dev/null +++ b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "MapoTofu_RECIPE_033122_31225.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/MapoTofu_RECIPE_033122_31225.jpg b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/MapoTofu_RECIPE_033122_31225.jpg new file mode 100644 index 0000000..5f2b025 Binary files /dev/null and b/CS342MemberViews/Sources/KatieLiu/Media.xcassets/Tofu.imageset/MapoTofu_RECIPE_033122_31225.jpg differ