Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Last active April 23, 2022 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosgyamfi/4e706d565462a61f2ef3834bc24e071e to your computer and use it in GitHub Desktop.
Save amosgyamfi/4e706d565462a61f2ef3834bc24e071e to your computer and use it in GitHub Desktop.
//
// MessagesDataModel.swift
// MessagesDataModel
//
//
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