-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContentView.swift
67 lines (60 loc) · 2.52 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// ContentView.swift
// accompliSHARE1
//
// Created by Michelle Han on 8/2/23.
//
import SwiftUI
struct ContentView: View {
@State private var searchText = ""
let people: [String] = ["Michelle Han", "Emily Markova", "Gnapika Birlangi", "Rachel Yoon", "Alicia Chiang", "Aayushi Garg", "Margot Robbie", "Taylor Swift", "Dwayne Johnson", "Karlie Kloss"]
var body: some View {
NavigationView {
VStack {
Text("Find Friends")
.font(.title)
.fontWeight(.bold)
.padding(.top, 90)
.padding(.bottom, 20)
TextField("Search...", text: $searchText)
.padding(7)
.background(Color.white)
.cornerRadius(8)
.padding(.horizontal, 10)
ScrollView {
VStack(spacing: 10) {
ForEach(people.filter { person in
!searchText.isEmpty && person.lowercased().contains(searchText.lowercased())
}, id: \.self) { person in
if person == "Karlie Kloss" {
NavigationLink(destination: KarlieKlossView1(user: User.MOCK_USERS[9])) {
Text(person)
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
.background(Color(red: 128/255, green: 185/255, blue: 235/255))
.cornerRadius(8)
.foregroundColor(.white)
}
} else {
Text(person)
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
.background(Color(red: 128/255, green: 185/255, blue: 235/255))
.cornerRadius(8)
.foregroundColor(.white)
}
}
}
.padding(.horizontal)
}
}
.background(Color(red: 240/255, green: 248/255, blue: 255/255))
.edgesIgnoringSafeArea(.all)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}