Skip to content

Instantly share code, notes, and snippets.

@hrvolapeter
Last active September 9, 2020 20:05
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 hrvolapeter/93e67e2051f31fcad8dba34971398124 to your computer and use it in GitHub Desktop.
Save hrvolapeter/93e67e2051f31fcad8dba34971398124 to your computer and use it in GitHub Desktop.
import SwiftUI
import UIKit
struct NoteDetailView: View {
@State var vm: Self.ViewModel // CHANGE
var body: some View {
ScrollView {
VStack {
TextField("Title", text: $vm.note.title) // CHANGE
.font(.title)
tags
MultilineTextField(text: $vm.note.content) // CHANGE
}.padding()
}.navigationBarTitle("", displayMode: .inline)
}
var tags: some View {
ScrollView(.horizontal) {
HStack {
ForEach(vm.note.tags, id: \.self) { tag in // CHANGE
HStack {
Text(tag).font(.footnote)
}.padding(7).lineLimit(1).background(Color.accentColor).foregroundColor(.white)
.cornerRadius(10)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment