The assets will be in whatever project the package is used in. To put the assets into the package itself is not good and, unfortunately, there isn't a Preview Content option with packages.
Post
Replies
Boosts
Views
Activity
Use Legacy Previews Execution is working so far.
I'm getting a JITError: Runtime linking failure error with the 16.0 release. Only 1 SwiftUI view so far. Use Legacy Previews Execution is working so far.
import SwiftUI
struct Dashboard: View {
var body: some View {
Text("hello")
}
}
#Preview {
Dashboard()
}
I am an *****. Never mind, I got the property name wrong.
Sorry, forgot to include the view code:
import SwiftUI
import CommonUI
import SwiftData
struct ChoreView: View {
@Bindable var chore: Chore
@Environment(\.modelContext) private var context
@Query private var familyMembers: [FamilyMember]
var body: some View {
Card {
Form {
Section("Name") {
TextField("Name", text: $chore.name)
}
Section("Frequency") {
Picker(selection: $chore.choreFrequency, label: EmptyView()) {
ForEach(ChoreFrequency.allCases) { frequency in
Text(frequency.rawValue.localized).tag(frequency.rawValue)
}
}
}
}
.frame(maxHeight: 400)
.padding(-6)
}
}
}
FamilyMember has hashable extension
I found a solution that works better for me here: https://stackoverflow.com/questions/77025438/how-do-i-preview-a-view-thats-using-bindable
found my issue… it involved an assert with a bool returning func that didn't throw. somehow,, wrapping the method call in assert caused it to not run.
Full test project here: https://github.com/AaronBratcher/DragTest
I know how to do it statically. The data shown here was for illustrative purposes. What if I have a form and want to send some user-entered form data? Or the new state of a toggle after the user flips it? If I can't, I can take another approach. I was just wondering if there's a way in my implementation.
...
Needed to enable code coverage in the scheme
Found my answer.
In the target dependencies, need to include the package name as a string:
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "DBCore",
dependencies: [
"AgileDB"
]),
.testTarget(
name: "DBCoreTests",
dependencies: ["DBCore"]),
]
Your understanding is correct. I believe it's a waste to download unnecessary files and thought there might be a way to prevent it from downloading a part of the hierarchy.
Thanks for the feedback.
Unfortunately that didn't work.