Last active
October 12, 2019 03:43
-
-
Save halavins/bf79035692038cfd60272e63705a6aa3 to your computer and use it in GitHub Desktop.
ChatRow struct from contentView.swift
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
// ChatRow will be a view similar to a Cell in standard Swift | |
struct ChatRow : View { | |
// we will need to access and represent the chatMessages here | |
var chatMessage: ChatMessage | |
// body - is the body of the view, just like the body of the first view we created when opened the project | |
var body: some View { | |
// HStack - is a horizontal stack. We let the SwiftUI know that we need to place | |
// all the following contents horizontally one after another | |
HStack { | |
Group { | |
Text(chatMessage.avatar) | |
Text(chatMessage.message) | |
.bold() | |
.padding(10) | |
.foregroundColor(Color.white) | |
.background(chatMessage.color) | |
.cornerRadius(10) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated on Oct 11, 2019