Skip to content

Commit

Permalink
Add New Views
Browse files Browse the repository at this point in the history
  • Loading branch information
katieliuu committed Jan 24, 2023
1 parent 7da0d81 commit 3baf4b6
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CS342Application.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -59,6 +60,7 @@
653A256128338800005D4D48 /* CS342ApplicationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CS342ApplicationTests.swift; sourceTree = "<group>"; };
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 = "<group>"; };
B6DFB7F3297F62B700916477 /* KatieLiu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KatieLiu.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -110,6 +112,7 @@
2F23F6B329700C7F003FECF4 /* MemberViews */ = {
isa = PBXGroup;
children = (
B6DFB7F3297F62B700916477 /* KatieLiu.swift */,
2FC8A09E297A34C900479145 /* OliverAalami.swift */,
2F23F6B129700C7B003FECF4 /* PaulSchmiedmayer.swift */,
);
Expand Down Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion CS342ApplicationUITests/InstructorsUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class InstructorsUITests: XCTestCase {
continueAfterFailure = false
}

func testInstructors() throws {
func testInstructors() throws {
let app = XCUIApplication()
app.launch()

Expand Down
36 changes: 36 additions & 0 deletions CS342ApplicationUITests/MemberViews/KatieLiu.swift
Original file line number Diff line number Diff line change
@@ -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()
}
}
6 changes: 2 additions & 4 deletions CS342MemberViews/Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// swift-tools-version: 5.7

//
// This source file is part of the CS342 2023 Application project
//
Expand All @@ -10,7 +9,6 @@

import PackageDescription


let package = Package(
name: "CS342MemberViews",
platforms: [
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
39 changes: 34 additions & 5 deletions CS342MemberViews/Sources/KatieLiu/KatieLiu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<NavigationPath>) {
self._navigationPath = navigationPath
}
Expand Down
18 changes: 18 additions & 0 deletions CS342MemberViews/Sources/KatieLiu/KatieLiuDest.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
76 changes: 76 additions & 0 deletions CS342MemberViews/Sources/KatieLiu/KatieLiuView.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3baf4b6

Please sign in to comment.