[Technical Questions] AccountButton scope #164
-
In what area do you have a technical challenge?Xcode, Simulator & Previews DescriptionI am getting an error saying cannot find 'AccountButton' in scope when trying to integrate account functionality to HKVisualization page. ReproductionWhen trying to build I get this error: I believe these lines of code are causing it: var body: some View {
self.readAllHKData()
return NavigationStack {
vizList
.navigationTitle("HKVIZ_NAVIGATION_TITLE")
.onAppear {
// Ensure that the data are up-to-date when the view is activated.
self.readAllHKData(ensureUpdate: true)
}
.toolbar {
ToolbarItem(placement: .navigation) {
if account != nil {
AccountButton(isPresented: $presentingAccount)
}
}
}
}
} Initially I thought there was something wrong in my file structure which is why SWIFT couldn't find the AccountButton declaration so I made sure all of my folders were gray as per this stack overflow suggestion: https://stackoverflow.com/questions/10353274/why-are-there-some-blue-folders-in-my-xcode-project Expected behaviorThe account button should appear on the top right corner of the page. Additional contextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Priyankas007 Seems like the build is not failing our main app; but your test target. It might be that you accidentally added some of your views to your test target. You should generally only use elements that are unit tests in the test target and you can access the system under test using |
Beta Was this translation helpful? Give feedback.
@Priyankas007 Seems like the build is not failing our main app; but your test target. It might be that you accidentally added some of your views to your test target. You should generally only use elements that are unit tests in the test target and you can access the system under test using
@testable
import statements. This article is a good help: https://www.avanderlee.com/swift/testing-private-methods-variables/