A SwiftUI tip everyone needs to know: Automatic Grammar Agreement
ฝัง
- เผยแพร่เมื่อ 7 มี.ค. 2023
- Automatic grammar agreement makes it easy to handle plurals in your app app across six different languages, and it's baked right into SwiftUI. See how to use it with this simple code example!
- วิทยาศาสตร์และเทคโนโลยี
I was expected to be underwhelmed but HOLY THAT'S AMAZING
Commenting so those asking can see easily - supported languages are English, Spanish, Portuguese, French, Italian, and German
Mind officially blown! I’d love more of these!
This is so great!
How were we supposed to know about this one if it wasn’t for you? Thank you!
Exactly, so many golden nuggets sprinkled absolutely everywhere all over the place 😮
I hope this video gets liked by a lot of person.
I see what you did there 😆
That was so good. Please keep doing this 😀
Paul, Paul, where has this been long long time ago!??? This is purely amazing 😃🤩🙌
I AM actually mind blown!!
OH MY GOD LOL, this is AMAZING.
This means... I have been writing long functions to do this for no reason all this time... T-T
Damn all these days I've been comparing values! Amazing tip!
And I’ve been using ternary operators lol . Good to know!
It's basically doing the same thing, only behind the scenes ...
The localization process is still one of the biggest pains ...
Thanks! I had this problem recently and I’m surprised that the solution is this simple.
Oh man I love this. Saves having to manually code it.
Incredible.
You should definitely do more of these. !!
Very cool tip!
Super cool tip! Definitely need more of these👍
Awesome work! Paul as always
Amazing!
Best swift teacher!!
Mind blown: wow, thanks!
A little mysterious but very cool! Do more!
So cool, gotta try this out for your example of country flags game.
Thanks.
This is a nice piece of code.
I had no idea that was possible!
Thank you so much❤
Wow, thanks! Please keep doing shorts!
This is awesome! 🤯
Rails has been doing inflection for over a decade.
Super Cool
Ohh that's really beautiful
@twostraws thank you so much for this! In my use case, I sometimes use fractions, so I've been using a string, which I've found doesn't work with this approach. Any advice for leveraging this for my case?
Super cool!
You weren't wrong 🤯 amazing! Paul is this a new feature of has it been around a while?
AGA.. interesting. thank you
What 6 Languages are supported?
Wow! How did you find this?
Nice!
woah this is cool
HOLY MOLY GUACAMOLE
Cool … never heard about it 😮
That is very nice
Amazing🎉🎉
That is amazing
Accurate. 🤯
What is inflex?im just beginning with swift.. thanks for your help
Cool!
Quick question - what’s up with this syntax? What does inflect mean? It seems kind of random. 😅
Think it’s short for “inflection” which means: “a change in the form of a word (typically the ending) to express a grammatical function or attribute such as tense, mood, person, number, case, and gender.”
💪🏼🙌🏼💪🏼
I have so many questions about how does it actually work.
can someone help me please ..
i have a SWIFTUI application with a flow as follows: A(landscape orientation)->B(landscape)-C(portrait)->D(portrait). also when I navigate back from C to B it should turn back to landscape as B is in landscape. (I am using NavigationLink in my application to navigate)How do I achieve the portrait lock in swiftUI.
i tried the .onAppear{} and .onDisappear{} method.. (firstly it is no longer available on ios 16 and secondly it gives a choppy animation where the view does not expand fully to take the new rotated screen size; there is white space after it rotates)
This is cool, but the short format is awful, you can't scrub the video if you want to go forward or back.
Is there a compile-time checked version of this not relying on string literals in the Text constructor? Like Text("\(count) [person]").inflect(true)
or something like that?
@hydro1337x I mean sure, but that is a less ideal setup I think
What 6 languages? Also.. is this a runtime thing?
🎉🎉🎉
What does it do when the count is 0?
Swift is a great programming language. However, the problem is that it is less popular in Asia and third-world countries.
What if you support other languages? How does it handle fallback?
Does it work with iOS 15?
😮
Really non-obvious feature...)) And which languages are supported? I consider, English only, or some bunch of Eu languages. But that's cool, maybe, it will be more convenient to use in future releases)
I'm flipping
This does not seem to work. Do I have to put the singular and plural versions into a localizable.strings file too?
Same for me. Changing the String type to LocalizedStringKey fixes it however.
@@ColeDano Bingo. Thank you.
so I'm the only one that can't get that 'carrot sign' by tapping 'shift' + 'control'?
It's the carot sign above the number 6 key, not the one above control
@@AlexCrocker thank you lol
whaaat
Woah what
Still needs work at 0
I'm sorry I've programmed for so long in UIKit and SwiftUI that nothing really sur...
IM SORRY WHAT DID YOU JUST DO?
Go flutter
bro?
wtf
This shouldn't be a thing in my opinion
😮