ContentView.swift 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2023 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import SwiftUI
  15. struct ContentView: View {
  16. @StateObject
  17. var viewModel = ConversationViewModel()
  18. @StateObject
  19. var functionCallingViewModel = FunctionCallingViewModel()
  20. var body: some View {
  21. NavigationStack {
  22. List {
  23. NavigationLink {
  24. SummarizeScreen()
  25. } label: {
  26. Label("Text", systemImage: "doc.text")
  27. }
  28. NavigationLink {
  29. PhotoReasoningScreen()
  30. } label: {
  31. Label("Multi-modal", systemImage: "doc.richtext")
  32. }
  33. NavigationLink {
  34. ConversationScreen()
  35. .environmentObject(viewModel)
  36. } label: {
  37. Label("Chat", systemImage: "ellipsis.message.fill")
  38. }
  39. NavigationLink {
  40. FunctionCallingScreen().environmentObject(functionCallingViewModel)
  41. } label: {
  42. Label("Function Calling", systemImage: "function")
  43. }
  44. }
  45. .navigationTitle("Generative AI Samples")
  46. }
  47. }
  48. }
  49. #Preview {
  50. ContentView()
  51. }