Skip to content

Instantly share code, notes, and snippets.

@AviTsadok
Created September 18, 2022 03:35
Show Gist options
  • Select an option

  • Save AviTsadok/70c91ba954593032805d7cdb9adfe905 to your computer and use it in GitHub Desktop.

Select an option

Save AviTsadok/70c91ba954593032805d7cdb9adfe905 to your computer and use it in GitHub Desktop.
NavigationWidgetFull.swift
struct NavigationWidget: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: NavigationAttributes.self) { context in
LockScreenView()
} dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.center) {
Text("ETA: " + context.state.eta.formatted())
}
DynamicIslandExpandedRegion(.bottom) {
Text("Heavy Traffic ahead!")
}
DynamicIslandExpandedRegion(.leading) {
Text(context.attributes.destination).font(.caption2)
}
DynamicIslandExpandedRegion(.trailing) {
Text(context.state.nextTurn.toString)
}
} compactLeading: {
Text(context.attributes.destination).font(.caption2)
} compactTrailing: {
Text(context.state.nextTurn.toString)
} minimal: {
Text(context.state.nextTurn.toString)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment