NACC_MainContentView

@MainActor
struct NACC_MainContentView : View

The initial app container View.

This is the principal view of the app. It is displayed upon startup.

It contains a textual report of the user’s set cleantime, and the user can tap the report to change their cleandate.

Below the report, is an image, showing the last keytag (for under a year), or medallion earned by the user, based on their cleandate.

At the top, is the app logo. Tapping on it (or the keytag/medallion logo) will show another screen, with images displaying multiple keytags or medalliuons.

  • This denotes the padding around the date display.

    Declaration

    Swift

    @MainActor
    private static let _buttonPaddingInDisplayUnits: Double
  • This denotes the horizontal padding around the text display.

    Declaration

    Swift

    @MainActor
    private static let _horizontalPaddingInDisplayUnits: Double
  • This is how big to make the top icon button.

    Declaration

    Swift

    @MainActor
    private static let _iconSizeInDisplayUnits: Double
  • This is how wide to make the displayed image.

    Declaration

    Swift

    @MainActor
    private static let _mainImageWidthInDisplayUnits: Double
  • This is the string that displays the “cleantime report.”

    Declaration

    Swift

    @MainActor
    private let _reportString: LGV_UICleantimeDateReportString
  • This is the local instance of the persistent prefs for the app.

    Declaration

    Swift

    @MainActor
    private let _prefs: NACCPersistentPrefs
  • This shows a date picker in a modal sheet. If the user taps on the date, they get the sheet.

    Declaration

    Swift

    @MainActor
    private var _calendarIsEnabled: Bool { get }
  • Scene phase, so we know when the app becomes active.

    Declaration

    Swift

    @Environment
    @MainActor
    private var scenePhase: ScenePhase { get }
  • This is set to true, when we want to show the action sheet.

    Declaration

    Swift

    @State
    @MainActor
    private var _showingActions: Bool { get nonmutating set }
  • This is set to true, when we want to show the share sheet.

    Declaration

    Swift

    @State
    @MainActor
    private var _showingShareSheet: Bool { get nonmutating set }
  • These are the items that we’ll be sending to the activity sheet.

    Declaration

    Swift

    @State
    @MainActor
    private var _activityItems: [Any] { get nonmutating set }
  • This shows a date picker in a modal sheet. If the user taps on the date, they get the sheet.

    Declaration

    Swift

    @State
    @MainActor
    private var _showingPicker: Bool { get nonmutating set }
  • If true, then the NavigationStack will bring in the info screen.

    Declaration

    Swift

    @State
    @MainActor
    private var _showInfo: Bool { get nonmutating set }
  • If true, then the event edit was denied permission, and we need to inform the user.

    Declaration

    Swift

    @State
    @MainActor
    private var _showCalendarAccessAlert: Bool { get nonmutating set }
  • When non-nil, we present the calendar event editor for this event.

    Declaration

    Swift

    @State
    @MainActor
    private var _eventToEdit: NACC_EventEditView.EditableEvent? { get nonmutating set }
  • This handles interaction with the Watch.

    Declaration

    Swift

    @State
    @MainActor
    private var _watchDelegateObject: NACCWatchAppContentViewWatchDelegate? { get nonmutating set }
  • This displays the last keytag or medallion earned.

    Declaration

    Swift

    @State
    @MainActor
    private var _displayedImage: UIImage? { get nonmutating set }
  • If true, then the NavigationStack will bring in the results screen.

    Declaration

    Swift

    @Binding
    @MainActor
    var showResult: Bool { get nonmutating set }
  • Declaration

    Swift

    @Binding
    @MainActor
    var selectedTab: NACC_TabIndexes { get nonmutating set }
  • This contains the cleandate.

    Declaration

    Swift

    @Binding
    @MainActor
    var selectedDate: Date { get nonmutating set }
  • Allows us to access the openURL capability.

    Declaration

    Swift

    @Environment
    @MainActor
    private var openURL: OpenURLAction { get }
  • This returns the contents of the textual report.

    Declaration

    Swift

    @MainActor
    private var _report: String { get }
  • This returns a URL string, with a universal URL that will open the app to this date, without invoking the report.

    Declaration

    Swift

    @MainActor
    private var _urlString: String { get }
  • Called when the NavBar calendar button is hit. We present a custom Calendar Date Entry screen, with a pre-populated state for a yearly repeating all-day event, starting on the cleandate. We always use a sheet, becaue it’s kind of a “fully modal” screen, and a popover dismisses too easily.

    See more

    Declaration

    Swift

    @MainActor
    private func _calendarButtonHit()
  • Prepares the items to be shared in the share sheet. We add a Report String, Universal URL, and Medallion/Keytag Image.

    Declaration

    Swift

    @MainActor
    private func _prepareActivityItems()
  • Creates the main screen print renderer.

    Declaration

    Swift

    @MainActor
    private func _makePrintRenderer() -> UIPrintPageRenderer?
  • Uses a UIPrintPageRenderer to present the standard print UI.

    Declaration

    Swift

    @MainActor
    private func _print(using inRenderer: UIPrintPageRenderer)

    Parameters

    inRenderer

    The custom renderer we’re using.

  • This returns a View, containing the main date display, and keytag/medallion display. The user can change the date.

    Declaration

    Swift

    @MainActor
    var body: some View { get }
  • This will update our internal state, to match the new application context that we received from the Watch.

    Declaration

    Swift

    @MainActor
    func updateApplicationContext(_ inApplicationContext: [String : Any])

    Parameters

    inApplicationContext

    The new context dictionary.