There is an inconvenience, which is described in this issue: https://github.com/BarredEwe/Prefire/issues/49. It consists in the fact that now the first line is taken as the Preview name in the macro. This is a problem if we wrap all views, for example in VStack.
Solution 📦
Using the filename as the main Preview name and adding an index to keep consistency and handle the case where multiple Previews are used in the same file.
Implementation 👩💻👨💻
The above is implemented plus tests are written.
if let previewBodies = previewBodies(from: content, defaultEnabled: defaultEnabled) {
let fileName = url.fileName
previewBodies.enumerated().forEach { index, previewBody in
previewBodyDictionary["\(fileName)_\(index)"] = previewBody
}
}
Short description 📝
There is an inconvenience, which is described in this issue: https://github.com/BarredEwe/Prefire/issues/49. It consists in the fact that now the first line is taken as the Preview name in the macro. This is a problem if we wrap all views, for example in
VStack
.Solution 📦
Using the filename as the main
Preview
name and adding an index to keep consistency and handle the case where multiplePreviews
are used in the same file.Implementation 👩💻👨💻
The above is implemented plus tests are written.