hummingbird-project / hummingbird-examples

Examples demonstrating various aspects of the Hummingbird swift server framework
Apache License 2.0
90 stars 19 forks source link

Attempting to modify todos-fluent-auth for postgres fails: 'User' is not a member type of struct 'App.App' #115

Closed deirdresm closed 2 months ago

deirdresm commented 2 months ago

Repo here: https://github.com/deirdresm/HBToDoFluentAuthPG

Only changes were in Package.swift (to include Postgres) and in Application+build.swift to conditionally add postgres, but the resulting error is in UserRepository.swift:

typealias User = App.User

…gets the error message: 'User' is not a member type of struct 'App.App'

Which, it's not in the sqlite version's definition of App either, so I'm mystified why one compiles and the other doesn't. So there's something that's inferred that Xcode's not finding.

This is on Xcode 16.0 (16A242d) on macOS 14.6.1 (23G93).

adam-fowler commented 2 months ago

The App in App.User refers to the executable target. You must have another symbol App in your executable.

adam-fowler commented 2 months ago

Yeah looking at your repo. If you rename the symbol App to something else then it should work fine. I assume you built this from the template. I have updated the symbol name in the template to AppCommand.

deirdresm commented 2 months ago

Confirmed that changing the symbol name to AppCommand fixes the issue. Thank you very much for your help.