Last active
January 24, 2022 17:05
-
-
Save amosgyamfi/817ccde7a5a41d2b978abb5337471d56 to your computer and use it in GitHub Desktop.
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
// | |
// MessagesDataModel.swift | |
// MessagesDataModel | |
// | |
// Created by Amos Gyamfi from Stream on 15/12/2021. | |
// | |
import Foundation | |
// Data structure | |
struct MessagesStructure: Identifiable { // Identifiable protocol - makes it possible to use value types that needs to have a stable notion of identity. | |
var id = UUID() // A universally unique identifier to identify a particular datafield and types | |
var unreadIndicator: String | |
var avatar: String | |
var name: String | |
var messageSummary: String | |
var timestamp: String | |
} | |
// Data storage using a dictionary. A dictionary stores items with key, value pairs. The order of items is not important when using dictionaries. | |
let MessageData = [ | |
MessagesStructure(unreadIndicator: "unreadIndicator", avatar: "jared", name: "Jared", messageSummary: "That's great, I can help you with that! What type of product are you...", timestamp: "13:30 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "martin", name: "Martin Steed", messageSummary: "I don't know why people are so anti pineapple pizza. I kind of like it.", timestamp: "12:40 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "jeroen", name: "Zach Friedman", messageSummary: "(Sad fact: you cannot search for a gif of the word “gif”, just gives you gifs.)", timestamp: "11:00 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "carla", name: "Akua Mansa", messageSummary: "There's no way you'll be able to jump your motorcycle over that bus.", timestamp: "10:36 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "zain", name: "Dee McRobie", messageSummary: "Tabs make way more sense than spaces. Convince me I'm wrong. LOL.", timestamp: "9:59 AM"), | |
MessagesStructure(unreadIndicator: "unreadIndicator", avatar: "nash", name: "Nash", messageSummary: "(Sad fact: you cannot search for a gif of the word “gif”, just gives you gifs.)", timestamp: "9:26 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "fra", name: "Francesco M.", messageSummary: "I don't know why people are so anti pineapple pizza. I kind of like it.", timestamp: "9:20 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "luke", name: "Luke", messageSummary: "There's no way you'll be able to jump your motorcycle over that bus.", timestamp: "9:16 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "maren", name: "Ama Aboakye", messageSummary: "Tabs make way more sense than spaces. Convince me I'm wrong. LOL.", timestamp: "9:00 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "zoey", name: "Zoey", messageSummary: "That's what I'm talking about!", timestamp: "8:59 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "gordon", name: "Gordon Hayes", messageSummary: "(Sad fact: you cannot search for a gif of the word “gif”, just gives you gifs.)", timestamp: "8:51 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "amos", name: "Amos G.", messageSummary: "Maybe email isn't the best form of communication.", timestamp: "9:36 AM"), | |
MessagesStructure(unreadIndicator: "unreadIndicator", avatar: "maren", name: "Yaa Aso", messageSummary: "There's no way you'll be able to jump your motorcycle over that bus.", timestamp: "8:50 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "dillion", name: "Dillion Megida", messageSummary: "That's what I'm talking about!", timestamp: "8:45 AM"), | |
MessagesStructure(unreadIndicator: "", avatar: "adam", name: "Adam Rush", messageSummary: "(Sad fact: you cannot search for a gif of the word “gif”, just gives you gifs.)", timestamp: "8:40 AM"), | |
MessagesStructure(unreadIndicator: "unreadIndicator", avatar: "thierry", name: "Thierry S.", messageSummary: "Maybe email isn't the best form of communication.", timestamp: "8:36 AM") | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment