Did you know you could access private properties 🤯 (but please don't do it in production)

  Рет қаралды 3,199

Vincent Pradeilles

Vincent Pradeilles

Күн бұрын

Пікірлер: 16
@v_pradeilles
@v_pradeilles 3 жыл бұрын
I'm going to say it here once more: do not use this trick in your production code 🙅🏻‍♂️ It's more than likely to get you into big troubles at one point or another ⚠️
@HumbleHustle101
@HumbleHustle101 Жыл бұрын
This technique can be super helpful in testing the private properties in the unit tests. Thanks for the nice video.
@donathmm3881
@donathmm3881 3 жыл бұрын
Thank you. It Would be better if you could've shown us what this first child prints in the end
@rahuljamba5846
@rahuljamba5846 Жыл бұрын
Great and excellent, Thanks for sharing your knowledge ❣❣❣
@HumbleHustle101
@HumbleHustle101 Жыл бұрын
Nice video, is there any way that we can declare private types in protocols?
@happycamperjack
@happycamperjack 3 жыл бұрын
Hmmm…. looking at the mirror for “private” stuffs. I wonder how Vincent got this idea from 🤔
@ArieP20
@ArieP20 3 жыл бұрын
Very well explained and a very cool technique using Mirror but in case of unit tests, couldn’t you have marked service as internal instead of private? Is it good practice to mark internal? I think I read something about it on Apple’s documentation.
@mykytakhlamov
@mykytakhlamov Жыл бұрын
great topic, thanks
@sanadbarjawi5646
@sanadbarjawi5646 3 жыл бұрын
Very good explanation!!
@konstantinosnikoloutsos3402
@konstantinosnikoloutsos3402 3 жыл бұрын
This is good but can we make it one step further and instead of string use something that will compile time check if property exists? Because if someone change his private class fields then we will only detect it at runtime. Can keypaths help us with this?
@v_pradeilles
@v_pradeilles 3 жыл бұрын
Unfortunately the runtime aspect is an inherent part of the technique, I’m not aware of anyway to go around it 😕
@ArvindYADAV-ex4mp
@ArvindYADAV-ex4mp 2 жыл бұрын
Thanks, Vincent, for this wonderful tutorial but I am curious, can we set the value in private property? I have tried from my side using as a string, I can access the private variable, but I am not able to set any new value to that variable.
@v_pradeilles
@v_pradeilles 2 жыл бұрын
Mirror is indeed a read-only API. So the only thing you could do, would be to mutate the state of a reference type property.
@xingzhao2449
@xingzhao2449 2 жыл бұрын
it can only be used in Class not Struct right?
@v_pradeilles
@v_pradeilles 2 жыл бұрын
I think Mirror should behave the same way with a struct.
@CRivlaldo
@CRivlaldo 2 жыл бұрын
Vincent teaches kids bad stuff 😂
Can we display HTML without a WebView? 🤯
7:08
Vincent Pradeilles
Рет қаралды 1,9 М.
Don't write this code! (the Error will slip through 🫣)
2:18
Vincent Pradeilles
Рет қаралды 2,3 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 14 МЛН
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 102 МЛН
This tiny computer changes EVERYTHING
15:57
Jeff Geerling
Рет қаралды 728 М.
ChatGPT in Xcode: is it good?  🤖
1:05:02
Vincent Pradeilles
Рет қаралды 1,3 М.
Compiling C# into NATIVE code, just like Go, Rust and C++
9:05
Nick Chapsas
Рет қаралды 83 М.
Is Apple Killing Swift? 🔪 🐥
8:53
Vincent Pradeilles
Рет қаралды 5 М.
It’s time to move on from Agile Software Development (It's not working)
11:07
Ladybird browser update (November 2024)
13:03
Ladybird
Рет қаралды 21 М.
You're Probably Wrong About Rainbows
27:11
Veritasium
Рет қаралды 3,6 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН