TheAcharya / MarkerData

The avant-garde Marker extraction application crafted for Final Cut Pro
https://markerdata.theacharya.co
MIT License
40 stars 2 forks source link

`'@StateObject' used inline will not work unless tagged with '@Previewable'` Warning when Building App #109

Closed IAmVigneswaran closed 1 month ago

IAmVigneswaran commented 1 month ago

Related to #106 & https://github.com/TheAcharya/MarkerData/issues/106#issuecomment-2380016195

Based on this apple developer forum post, this is a known issue in Xcode 16.

I believe this '@StateObject' used inline will not work unless tagged with '@Previewable' it would be fixed in future versions of Xcode.

Related - https://www.avanderlee.com/swiftui/previewable-macro-usage-in-previews/ https://stackoverflow.com/questions/60105438/swiftui-preview-provider-with-binding-variables/66175501#66175501 https://www.hackingwithswift.com/forums/swift/new-atpreviewable-and-previewer-issues-for-swiftdata/27357 https://www.reddit.com/r/SwiftUI/comments/18xdv0h/why_dont_we_need_stateobject_since_xcode_15/?rdt=55626

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Other/ExportDestinationPicker.swift:106:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:356:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:357:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:359:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var extractionModel = ExtractionModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/Label/OverlaySettingsView.swift:143:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/FileSettingsView.swift:116:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/FileSettingsView.swift:117:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/NotificationSettingsView.swift:55:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/NotificationSettingsView.swift:56:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:139:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:140:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:142:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var extractionModel = ExtractionModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:147:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var queueModel = QueueModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:184:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:185:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:187:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var queueModel = QueueModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/Image/SwatchSettingsView.swift:94:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Other/ExportDestinationPicker.swift:106:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:356:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:357:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ExtractView.swift:359:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var extractionModel = ExtractionModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/Label/OverlaySettingsView.swift:143:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/FileSettingsView.swift:116:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/FileSettingsView.swift:117:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/NotificationSettingsView.swift:55:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/General Settings/NotificationSettingsView.swift:56:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:139:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:140:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:142:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var extractionModel = ExtractionModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Main/ContentView.swift:147:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var queueModel = QueueModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:184:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:185:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var databaseManager = DatabaseManager(settings: settings)
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/QueueView.swift:187:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var queueModel = QueueModel(
    ^~~~~~~~~~~~

⚠️  /Users/runner/work/MarkerData/MarkerData/Source/Marker Data/Marker Data/Views/Detail Views/Image/SwatchSettingsView.swift:94:5: '@StateObject' used inline will not work unless tagged with '@Previewable'

    @StateObject var settings = SettingsContainer()
    ^~~~~~~~~~~~

Hopefully we can address this in future versions of Marker Data.

IAmVigneswaran commented 1 month ago

@milanvarady I have attempted to fix the '@StateObject' used inline will not work unless tagged with '@Previewable' the warnings using ChatGPT.

I have created a separate branch. https://github.com/TheAcharya/MarkerData/tree/Fix-Warning

Based on this initial build, there were no warnings.

I have also created test-build. On using the application, there were no apparent issues on first glance.

However, could you please check is the code / approach is correct or if it might pose or conflict with our remain codebase.

https://github.com/TheAcharya/MarkerData/compare/main...Fix-Warning

Thank you.

milanvarady commented 1 month ago

I have fixed the previews and updated some other ones as well.