Wow. Your video is the best in describing how one should be writing macros in swift. Really appreciate how you went over the purpose of writing the macro and the fundamental steps such as finding the goal before trying to write the macro. Apple WWDC video on this was absolutely bad and never went any of those things you did in this video.
One of better videos I have seen in a while on the topic of Swift (and its new functionalities), great job on explaining and presenting the new macros. Thank you, I hope to see more of your videos in future.
@@kitlangton I was able to recreate the Form view like you did based on your tutorial. Having watched your video twice already, I think I understand it even better now. One issue I ran into was the optional String type parameter in my model object. In the expanded macro code I ran into compiler error "Global function 'makeValue' requires that 'String?' conform to 'FormBuilder'". Resolved it by checking if the type annotation is 'SimpleTypeIdentifierSyntax.self' and not 'OptionalTypeSyntax.self'. I am not really satisfied with my solution as it prevents me from creating a form view that is binded to optional parameter in the model object.
Ah, yes, I didn’t yet handle options or list parameters. We’ll have to come up with some FormBuilder implementation for Option where A has its own FormBuilder. I’ll sketch something up sometime this week :)
Hello! Nice video. Can I find the updated part (conformance -> extension) on your twitter/patreon/etc? I am interested in macros, the only problem is the lack of good learning material for it. Your video was the first which got me closer to understanding macros, thanks.🤓
Thanks! Woo! Very glad to spread the macro love. Ah yes, someone else asked about that API change. I'll update the code and throw it on GitHub ASAP :D (hopefully tonight!)
Nice! Thanks for this, very much like your style! (somewhat reminds me of Ambiguous Amphibian). Subscribed in case you one day put up another vid! C/C++ macros are literally text search and replace by a pre-processor, so, yeah, they are not "safe" by any sense of the word.
Nice video. I have a question regarding swift macros: Can we create such macro that tests the code as we write it. For example If I write a "func add(_ a: Int, _ b: Int) -> Int { return a + b }" then it writes all the possible unit tests for it like this "func testAdd() { // Test case 1: Adding two positive numbers assert(add(3, 5) == 8, "Adding 3 and 5 should equal 8") // Test case 2: Adding a positive and a negative number assert(add(10, -5) == 5, "Adding 10 and -5 should equal 5") // Test case 3: Adding two negative numbers assert(add(-8, -2) == -10, "Adding -8 and -2 should equal -10") // Test case 4: Adding zero to a number assert(add(7, 0) == 7, "Adding 7 and 0 should equal 7") // Test case 5: Adding zero to zero assert(add(0, 0) == 0, "Adding 0 and 0 should equal 0") print("All tests passed successfully!") }" ?
Wow. Your video is the best in describing how one should be writing macros in swift. Really appreciate how you went over the purpose of writing the macro and the fundamental steps such as finding the goal before trying to write the macro. Apple WWDC video on this was absolutely bad and never went any of those things you did in this video.
i just discovered your channel, and what a great channel, Thank you for the free tutorial and keep it up please.
Thanks very much ❤️
Fantastic explanation! Great intermediate and above tutorial!
One of better videos I have seen in a while on the topic of Swift (and its new functionalities), great job on explaining and presenting the new macros.
Thank you, I hope to see more of your videos in future.
Thanks so much. I’ll surely record some more 🥰
Great video. Looking for more and more content like this.
The only channel where subscription bell is ON. Never gonna miss the video ✌🏻 Thanks for your time
Wowza! I am flattered
🛎️🔨👌😅
Amazing tutorial!
👯 Very glad you liked it!
Thank you so much for explaining something so complex in a simple and relaxed way. Relaxing to watch really.
Thank you for the kind words. Glad to hear macros can be relaxing! 😎
great presentation of this cool swift macro stuff 🏆
Thank you for the trophy!
🏆
🙌
😭
OMG This was just so oddly and wonderfully satisfying. Rust FTW. Kit your talent for presentation is something to aspire to.
Haha. Thank you! Russ FTW!
You inspired me to write a Macro with your video. I'm going to try to educate my team also.
Great stuff.
Hooray! Do it! 😊
Let me know if you run into any trouble. I’d love to make some follow up videos on any tricky issues people might run into.
@@kitlangton I was able to recreate the Form view like you did based on your tutorial. Having watched your video twice already, I think I understand it even better now.
One issue I ran into was the optional String type parameter in my model object. In the expanded macro code I ran into compiler error "Global function 'makeValue' requires that 'String?' conform to 'FormBuilder'". Resolved it by checking if the type annotation is 'SimpleTypeIdentifierSyntax.self' and not 'OptionalTypeSyntax.self'.
I am not really satisfied with my solution as it prevents me from creating a form view that is binded to optional parameter in the model object.
Ah, yes, I didn’t yet handle options or list parameters. We’ll have to come up with some FormBuilder implementation for Option where A has its own FormBuilder. I’ll sketch something up sometime this week :)
@@kitlangtonThank you for this video; I just updated my MacBook to try Swift 5.9. Will you make a follow-up video on handling Option types?
Thanks, great explanation!
You're very welcome! Glad to be of service :)
Earned a sub. U might be the 3blue1brown of swift macros
Hahaha. That's quit the title :) Thank you very much!
Hello!
Nice video. Can I find the updated part (conformance -> extension) on your twitter/patreon/etc? I am interested in macros, the only problem is the lack of good learning material for it. Your video was the first which got me closer to understanding macros, thanks.🤓
Thanks! Woo! Very glad to spread the macro love.
Ah yes, someone else asked about that API change. I'll update the code and throw it on GitHub ASAP :D (hopefully tonight!)
@@kitlangton Its great to see something different after hundreds and hundreds of to-do-list tutorial videos.🤪
I honestly almost fell asleep from the official video This one is really cool explanation! Thank you
Woo! I always aim to keep folks conscious 😋
The ConformanceMarco not in Scope. i saw the are changed to ExtensionMacro, can u show a solution? 😢
Ah yes, they appeared to have altered that. I'll take a look and update the code/possibly release a small video update.
Amazing video thanks ❤
You're very welcome, Lucas! Thanks for the kind comment :)
Great explanation, thanks
Glad it was helpful! 🥰
Nice! Thanks for this, very much like your style! (somewhat reminds me of Ambiguous Amphibian). Subscribed in case you one day put up another vid!
C/C++ macros are literally text search and replace by a pre-processor, so, yeah, they are not "safe" by any sense of the word.
It’s criminal this channel only has 1k subs. I would sub 50 times if I could
Agreed! And I will arrest those who have not subscribed! ⛓️
p.s. Thanks so much 🥰 and, uh, tell 49,000 other people!
Awesome!
Thank you! Cheers!
Amazing
No, you are!
(Thank you very much 🥰)
Nice video. I have a question regarding swift macros: Can we create such macro that tests the code as we write it. For example If I write a "func add(_ a: Int, _ b: Int) -> Int {
return a + b
}" then it writes all the possible unit tests for it like this "func testAdd() {
// Test case 1: Adding two positive numbers
assert(add(3, 5) == 8, "Adding 3 and 5 should equal 8")
// Test case 2: Adding a positive and a negative number
assert(add(10, -5) == 5, "Adding 10 and -5 should equal 5")
// Test case 3: Adding two negative numbers
assert(add(-8, -2) == -10, "Adding -8 and -2 should equal -10")
// Test case 4: Adding zero to a number
assert(add(7, 0) == 7, "Adding 7 and 0 should equal 7")
// Test case 5: Adding zero to zero
assert(add(0, 0) == 0, "Adding 0 and 0 should equal 0")
print("All tests passed successfully!")
}" ?
Ah, for that you'd probably want to look into property based testing :D