Closed xenodium closed 3 years ago
I'm interested! This looks very helpful. Great job @xenodium
I'm interested!
Nice. @scott56gps we may want to consider a separate package (maybe ob-swiftui). ob-swift seems a little inactive. Goals are likely different enough for separate packages anyway.
I agree that a separate package would be appropriate. By the way, I ran the swiftui code yesterday and it works great!
By the way, I ran the swiftui code yesterday and it works great!
Ah nice to hear @scott56gps! Gave me a good nudge to give it a go... see if ob-swiftui works for ya. I'm sure it'll need changes but it's a start.
ps. It also supports multiple view structs now.
#+begin_src swiftui :results window :view FooView
struct FooView: View {
var body: some View {
VStack(spacing: 10) {
BarView()
BazView()
}
}
}
struct BarView: View {
var body: some View {
Rectangle()
.fill(Color.yellow)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
struct BazView: View {
var body: some View {
Rectangle()
.fill(Color.blue)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
#+end_src
@xenodium, I just installed the updated ob-swiftui.el and it works great! Thank you for providing this functionality.
Thanks @scott56gps. Great to hear!
Can this be used somehow as a minor mode to preview SwiftUI in Emacs? I mean outside org-mode. Like a side by side buffer ala Xcode? How can we preview more complex views with dependencies that lives outside the view?
Can this be used somehow as a minor mode to preview SwiftUI in Emacs?
As is, no. But the logic could be moved/extended. Needs work.
Wrote a snippet patching org-babel-execute:swift to preview SwiftUI blocks. Interested in including in ob-swift? Happy to send PR.
Wrote about it here http://xenodium.com/swiftui-layout-previews-using-emacs-org-blocks