A SwiftUI tip everyone needs to know: Automatic Grammar Agreement
Vložit
- čas přidán 7. 03. 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!
- Věda a technologie
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!
I hope this video gets liked by a lot of person.
I see what you did there 😆
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 😮
That was so good. Please keep doing this 😀
Paul, Paul, where has this been long long time ago!??? This is purely amazing 😃🤩🙌
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
Thanks! I had this problem recently and I’m surprised that the solution is this simple.
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 ...
Oh man I love this. Saves having to manually code it.
Incredible.
You should definitely do more of these. !!
Super cool tip! Definitely need more of these👍
Very cool tip!
So cool, gotta try this out for your example of country flags game.
Awesome work! Paul as always
A little mysterious but very cool! Do more!
Best swift teacher!!
Mind blown: wow, thanks!
I had no idea that was possible!
This is a nice piece of code.
Amazing!
Wow, thanks! Please keep doing shorts!
Rails has been doing inflection for over a decade.
This is awesome! 🤯
Ohh that's really beautiful
Thanks.
@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?
Thank you so much❤
Super cool!
You weren't wrong 🤯 amazing! Paul is this a new feature of has it been around a while?
Wow! How did you find this?
Cool … never heard about it 😮
Super Cool
AGA.. interesting. thank you
woah this is cool
Nice!
Amazing🎉🎉
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.”
That is very nice
What 6 Languages are supported?
That is amazing
HOLY MOLY GUACAMOLE
Accurate. 🤯
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 is inflex?im just beginning with swift.. thanks for your help
Cool!
💪🏼🙌🏼💪🏼
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)
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)
What 6 languages? Also.. is this a runtime thing?
What does it do when the count is 0?
What if you support other languages? How does it handle fallback?
Does it work with iOS 15?
🎉🎉🎉
Swift is a great programming language. However, the problem is that it is less popular in Asia and third-world countries.
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.
I'm flipping
😮
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
This is cool, but the short format is awful, you can't scrub the video if you want to go forward or back.
I'm sorry I've programmed for so long in UIKit and SwiftUI that nothing really sur...
IM SORRY WHAT DID YOU JUST DO?
Woah what
whaaat
Go flutter
Still needs work at 0
bro?
wtf
This shouldn't be a thing in my opinion
😮