Last active
September 19, 2023 02:05
-
-
Save plskz/2fad7e3221114e134d808460dfc2ae95 to your computer and use it in GitHub Desktop.
Swift Playground - Discord Chat UI
This file contains hidden or 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 ContentView: View { | |
var body: some View { | |
VStack { | |
HStack { | |
Image(uiImage: #imageLiteral(resourceName: "Fif9dcDXEAAJ1Ul.jpeg")) | |
.resizable() | |
.scaledToFit() | |
.clipShape(Circle()) | |
.frame(width: 64, height: 64) | |
VStack (alignment: .leading, spacing: 10) { | |
HStack { | |
Text("Aai") | |
.font(.title) | |
.foregroundColor(.blue) | |
Text("Today at 6:25 AM") | |
.foregroundColor(.gray) | |
} | |
Text("Hello, World!") | |
} | |
} | |
} | |
} | |
} | |
PlaygroundPage.current.setLiveView(ContentView()) |
This file contains hidden or 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 ContentView: View { | |
var body: some View { | |
VStack { | |
DiscordChat(time: "6:25 AM", msg: "Hello, world!") | |
DiscordChat(time: "7:30 AM", msg: "Swiftyy") | |
DiscordChat(time: "9:17 AM", msg: "Raawr") | |
} | |
} | |
} | |
struct DiscordChat: View { | |
var name: String = "Aai" | |
var time: String | |
var msg: String | |
var body: some View { | |
VStack { | |
HStack { | |
Image(uiImage: #imageLiteral(resourceName: "Fif9dcDXEAAJ1Ul.jpeg")) | |
.resizable() | |
.scaledToFit() | |
.clipShape(Circle()) | |
.frame(width: 64, height: 64) | |
VStack (alignment: .leading, spacing: 10) { | |
HStack { | |
Text(name) | |
.font(.title) | |
.foregroundColor(.blue) | |
Text("Today at \(time)") | |
.foregroundColor(.gray) | |
} | |
Text(msg) | |
} | |
} | |
} | |
// .background(.pink) | |
} | |
} | |
PlaygroundPage.current.setLiveView(ContentView()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment