Last active
June 23, 2020 05:07
-
-
Save miotke/ed477959a89a002e30a1f8ee7e83fffd 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
// This code does not create a functional list view | |
// but does split the views into two different functional views. | |
// The button acts strictly as a button therefore the highlight | |
// disappears immediatly after the tap gesture is dismissed. | |
// I'm sure there will be a better way to do this and hopefully | |
// we learn of one at WWDC2020. For now this kind gets you by. | |
import SwiftUI | |
struct ContentView: View { | |
@State var listNumber = 0 | |
var body: some View { | |
NavigationView { | |
VStack { | |
List { | |
ForEach(1..<100) { noteIndex in | |
Button(action: { | |
self.listNumber = noteIndex | |
}) { | |
Text("Note \(noteIndex)") | |
} | |
} | |
} | |
} | |
.navigationTitle(Text("Split view?")) | |
ZStack { | |
VStack { | |
Text("Body of what could be a note") | |
.fontWeight(.heavy) | |
.font(.system(size: 30)) | |
.foregroundColor(.blue) | |
Text("Just some text, blah blah blah") | |
.font(.subheadline) | |
.foregroundColor(.gray) | |
Text("Selected cell \(listNumber)") | |
} | |
} | |
} | |
.navigationViewStyle(DoubleColumnNavigationViewStyle()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment