Created
August 11, 2020 23:15
-
-
Save navsing/e6a9be0742dc10acf4d2d9941f815274 to your computer and use it in GitHub Desktop.
Recreating the Threads app by Instagram using SwiftUI and Swift Playgrounds on iPad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
var body: some View { | |
VStack (spacing: 24) { | |
HStack { | |
Image(systemName: "line.horizontal.3").padding().background(Color.secondary.opacity(0.2)).clipShape(Circle()) | |
Spacer() | |
Image(systemName: "person.crop.circle.fill.badge.plus").resizable().frame(width: 60, height: 50).foregroundColor(Color.secondary.opacity(0.5)) | |
Spacer() | |
Image(systemName: "camera.fill").padding().background(Color.secondary.opacity(0.2)).clipShape(Circle()) | |
} | |
ScrollView (.vertical) { | |
VStack (spacing: 24) { | |
HStack { | |
Image(systemName: "magnifyingglass") | |
Text("Search") | |
Spacer() | |
}.padding(.all, 8).frame(width: 400).foregroundColor(.secondary).background(Color.gray.opacity(0.1)).cornerRadius(18) | |
MessageCellUnread() | |
ForEach(1..<10) { _ in | |
MessageCellRead() | |
} | |
} | |
} | |
}.padding().edgesIgnoringSafeArea(.bottom) | |
} | |
} | |
struct MessageCellRead: View { | |
var body: some View { | |
HStack (spacing: 18) { | |
Image(systemName: "person.crop.circle.fill").resizable().frame(width: 60, height: 60).foregroundColor(Color.secondary.opacity(0.5)) | |
VStack (alignment: .leading, spacing: 2) { | |
Text("username") | |
Text("Message Content Goes Here.").font(.footnote) | |
Text("Active today").font(.caption).foregroundColor(.secondary) | |
} | |
Spacer() | |
} | |
} | |
} | |
struct MessageCellUnread: View { | |
var body: some View { | |
HStack (spacing: 18) { | |
Image(systemName: "person.crop.circle.fill").resizable().frame(width: 60, height: 60).foregroundColor(Color.secondary.opacity(0.5)) | |
VStack (alignment: .leading, spacing: 2) { | |
Text("username").bold() | |
Text("Message Content Goes Here.").font(.footnote).bold() | |
} | |
Spacer() | |
Image(systemName: "circle.fill").foregroundColor(Color(UIColor.systemIndigo)) | |
} | |
} | |
} | |
PlaygroundPage.current.setLiveView(Screen()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment