A SwiftUI tip everyone needs to know: Automatic Grammar Agreement

  Рет қаралды 46,711

Paul Hudson

Paul Hudson

Жыл бұрын

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!

Пікірлер: 81
@joevero4568
@joevero4568 Жыл бұрын
I was expected to be underwhelmed but HOLY THAT'S AMAZING
@alexandersereno
@alexandersereno 9 ай бұрын
Commenting so those asking can see easily - supported languages are English, Spanish, Portuguese, French, Italian, and German
@jconstant
@jconstant Жыл бұрын
Mind officially blown! I’d love more of these!
@joee8227
@joee8227 Жыл бұрын
I hope this video gets liked by a lot of person.
@ericnail1
@ericnail1 20 күн бұрын
I see what you did there 😆
@TheOnlyTripo
@TheOnlyTripo Жыл бұрын
This is so great! How were we supposed to know about this one if it wasn’t for you? Thank you!
@alejmc
@alejmc 10 ай бұрын
Exactly, so many golden nuggets sprinkled absolutely everywhere all over the place 😮
@TsiriniainaRakotonirina
@TsiriniainaRakotonirina Жыл бұрын
Paul, Paul, where has this been long long time ago!??? This is purely amazing 😃🤩🙌
@TheiTE
@TheiTE Жыл бұрын
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
@nigelhamilton6359
@nigelhamilton6359 Жыл бұрын
That was so good. Please keep doing this 😀
@Pseudonaym
@Pseudonaym Жыл бұрын
Damn all these days I've been comparing values! Amazing tip!
@gabrielf111
@gabrielf111 11 ай бұрын
Thanks! I had this problem recently and I’m surprised that the solution is this simple.
@nonyabidness5784
@nonyabidness5784 Жыл бұрын
Oh man I love this. Saves having to manually code it.
@juliansha2590
@juliansha2590 10 ай бұрын
And I’ve been using ternary operators lol . Good to know!
@zetrix6277
@zetrix6277 5 ай бұрын
It's basically doing the same thing, only behind the scenes ... The localization process is still one of the biggest pains ...
@ninelostsouls
@ninelostsouls Жыл бұрын
Incredible. You should definitely do more of these. !!
@flora6465
@flora6465 Жыл бұрын
Super cool tip! Definitely need more of these👍
@marcellerusu
@marcellerusu Ай бұрын
Amazing!
@flymanhawaii
@flymanhawaii 9 ай бұрын
So cool, gotta try this out for your example of country flags game.
@thriveflourishmotivate
@thriveflourishmotivate 9 ай бұрын
Best swift teacher!!
@jcut
@jcut Жыл бұрын
Very cool tip!
@vrplayz4601
@vrplayz4601 Жыл бұрын
Awesome work! Paul as always
@richardalbury
@richardalbury Жыл бұрын
Mind blown: wow, thanks!
@haineux
@haineux Жыл бұрын
A little mysterious but very cool! Do more!
@jessielinden2961
@jessielinden2961 Жыл бұрын
@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?
@yariva2
@yariva2 Жыл бұрын
Wow, thanks! Please keep doing shorts!
@JakeLovesSteak
@JakeLovesSteak Жыл бұрын
I had no idea that was possible!
@NyxAndrew
@NyxAndrew 10 ай бұрын
Thanks.
@Johnged15
@Johnged15 Жыл бұрын
This is a nice piece of code.
@carlosswiftdev2703
@carlosswiftdev2703 Жыл бұрын
You weren't wrong 🤯 amazing! Paul is this a new feature of has it been around a while?
@joenaveau
@joenaveau Жыл бұрын
This is awesome! 🤯
@joenaveau
@joenaveau Жыл бұрын
Quick question - what’s up with this syntax? What does inflect mean? It seems kind of random. 😅
@chocomilkfps1264
@chocomilkfps1264 3 ай бұрын
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.”
@casperes0912
@casperes0912 Жыл бұрын
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?
@casperes0912
@casperes0912 Жыл бұрын
@hydro1337x I mean sure, but that is a less ideal setup I think
@_Half_Byte_
@_Half_Byte_ 11 ай бұрын
Ohh that's really beautiful
@jim.haungs
@jim.haungs Жыл бұрын
Rails has been doing inflection for over a decade.
@patgarner
@patgarner Жыл бұрын
Super cool!
@user-ic2tx9sb1m
@user-ic2tx9sb1m Жыл бұрын
Thank you so much❤
@GregT-gf9ny
@GregT-gf9ny Жыл бұрын
Wow! How did you find this?
@user-ib4wj9nf2c
@user-ib4wj9nf2c 10 ай бұрын
Super Cool
@sebasyanni1258
@sebasyanni1258 4 ай бұрын
What is inflex?im just beginning with swift.. thanks for your help
@enoch8835
@enoch8835 6 ай бұрын
woah this is cool
@user-rs3pf3bt7m
@user-rs3pf3bt7m Жыл бұрын
Amazing🎉🎉
@devayz9305
@devayz9305 Жыл бұрын
AGA.. interesting. thank you
@mathesonstep
@mathesonstep Жыл бұрын
That is amazing
@ahikmatf
@ahikmatf 7 ай бұрын
HOLY MOLY GUACAMOLE
@ralfboernemeier9724
@ralfboernemeier9724 Жыл бұрын
Cool … never heard about it 😮
@vasilbaramidze4185
@vasilbaramidze4185 Жыл бұрын
Nice!
@seccat
@seccat 7 ай бұрын
What 6 Languages are supported?
@pawekoaczynski4505
@pawekoaczynski4505 Жыл бұрын
That is very nice
@mmoriarty
@mmoriarty 2 ай бұрын
Accurate. 🤯
@Deadpool25mm
@Deadpool25mm Жыл бұрын
Cool!
@angelmanuel727
@angelmanuel727 10 ай бұрын
💪🏼🙌🏼💪🏼
@danvilela
@danvilela 10 ай бұрын
What 6 languages? Also.. is this a runtime thing?
@VladislavVaz
@VladislavVaz 10 ай бұрын
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)
@bobthemagicmoose
@bobthemagicmoose 9 ай бұрын
What if you support other languages? How does it handle fallback?
@dskygn
@dskygn Ай бұрын
I have so many questions about how does it actually work.
@Deadlineru
@Deadlineru Жыл бұрын
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)
@chriswaco
@chriswaco Жыл бұрын
This does not seem to work. Do I have to put the singular and plural versions into a localizable.strings file too?
@ColeDano
@ColeDano Жыл бұрын
Same for me. Changing the String type to LocalizedStringKey fixes it however.
@chriswaco
@chriswaco Жыл бұрын
@@ColeDano Bingo. Thank you.
@ihwan_id
@ihwan_id Жыл бұрын
🎉🎉🎉
@EdmundTrujillo
@EdmundTrujillo 8 ай бұрын
What does it do when the count is 0?
@tdrg_
@tdrg_ Жыл бұрын
Does it work with iOS 15?
@akar._.J
@akar._.J 9 ай бұрын
Swift is a great programming language. However, the problem is that it is less popular in Asia and third-world countries.
@alanwill
@alanwill 10 ай бұрын
😮
@AlanW
@AlanW Жыл бұрын
This is cool, but the short format is awful, you can't scrub the video if you want to go forward or back.
@rondamon4408
@rondamon4408 9 ай бұрын
I'm flipping
@30guarino
@30guarino Жыл бұрын
so I'm the only one that can't get that 'carrot sign' by tapping 'shift' + 'control'?
@AlexCrocker
@AlexCrocker Жыл бұрын
It's the carot sign above the number 6 key, not the one above control
@30guarino
@30guarino Жыл бұрын
@@AlexCrocker thank you lol
@xingzhexin8843
@xingzhexin8843 Жыл бұрын
I'm sorry I've programmed for so long in UIKit and SwiftUI that nothing really sur... IM SORRY WHAT DID YOU JUST DO?
@alan.otoole
@alan.otoole 10 ай бұрын
Woah what
@plskz
@plskz Жыл бұрын
whaaat
@jorge1869
@jorge1869 8 ай бұрын
Go flutter
@androidfanatic6528
@androidfanatic6528 Жыл бұрын
Still needs work at 0
@orihpt
@orihpt Жыл бұрын
bro?
@pedro8769
@pedro8769 11 ай бұрын
wtf
@christianremboldt1557
@christianremboldt1557 7 ай бұрын
This shouldn't be a thing in my opinion
@matthewdolan720
@matthewdolan720 Жыл бұрын
😮
5 Steps to Better SwiftUI Views
31:19
Paul Hudson
Рет қаралды 55 М.
Firebase - Back to the Basics
25:23
Fireship
Рет қаралды 583 М.
I wish I could change THIS fast! 🤣
00:33
America's Got Talent
Рет қаралды 128 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 93 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 17 МЛН
24 Xcode Tips in 15 Minutes
15:30
Paul Hudson
Рет қаралды 73 М.
What’s new in Angular v18
20:08
Angular
Рет қаралды 104 М.
Write Better Code with Swift Algorithms
34:34
Paul Hudson
Рет қаралды 31 М.
Python vs Swift | Chris Lattner and Lex Fridman
11:16
Lex Clips
Рет қаралды 150 М.
Swift 5.9 Released | Prime Reacts
14:36
ThePrimeTime
Рет қаралды 64 М.
Learn the Essentials of Swift in one hour
58:14
Paul Hudson
Рет қаралды 177 М.
What does larger scale software development look like?
24:15
Web Dev Cody
Рет қаралды 1,3 МЛН
Mastering Picture Editing: Zoom Tools Tutorial
0:52
Photoo Edit
Рет қаралды 505 М.
Я УКРАЛ ТЕЛЕФОН В МИЛАНЕ
9:18
Игорь Линк
Рет қаралды 55 М.
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 29 МЛН