Recreating the iOS Messages App with SwiftUI

Learn how to recreate the iOS Messages App using SwiftUI

ML Musings
3 min readJan 20, 2023

I wrote these little pieces of code using Swift with Swift Playgrounds on an iPad.

Conversations

import SwiftUI
import PlaygroundSupport

struct Screen: View {
var body: some View {
NavigationView {
VStack {
ScrollView (.vertical, showsIndicators: false) {
SearchBar()
Pins()
ForEach(0..<20) {_ in
NavigationLink(destination: Text("chat view")) {
VStack {
MessageCell()
Divider()
}.padding(.horizontal)
}
}
}
}.padding().navigationBarTitle("Messages", displayMode: .inline).navigationBarItems(leading: Button(action:{}) {
Text("Edit")
}, trailing: Button(action:{}) {
Image(systemName: "square.and.pencil")
}).edgesIgnoringSafeArea(.bottom)
}.navigationViewStyle(StackNavigationViewStyle())
}
}

struct SearchBar: View {
var body: some View {
HStack {
HStack {
Image(systemName: "magnifyingglass")
Text("Search")…

--

--

ML Musings

✨ I enjoy pushing the boundaries of JS, Python, SwiftUI and AI. You can support my work through coffee - www.buymeacoffee.com/MLMusings