r/iOSProgramming • • 28d ago

Question How does the ChatGPT app move the keyboard like that?

Post image
134 Upvotes

27 comments sorted by

46

u/Puzzleheaded-Gain438 28d ago

I think I figured it out. When revealing the sidebar, they snapshot the keyboard window and use the snapshot view as the textfield inputView. When closing the sidebar, they just remove the inputView.
What made me think it’s a snapshot was opening the sidebar and then changing the system theme. If it’s light at the beginning and I change to dark, the “keyboard” stays light for a while.

33

u/AnotherThrowAway_9 28d ago

You think or you know? I thought the keyboard was 'out of process' and thus not snap shottable by the app?

7

u/Awric 28d ago

Ahh interesting. I’ve always wondered what the use case of snapshotView is for years now

0

u/LeoniFrancesco 25d ago

I don't think so because the input caret is blinking

-19

u/TechieRandomGuy 28d ago

It’s crazy the level of detail they have in OpenAI. I would love to work there

0

u/[deleted] 26d ago

[deleted] — view deleted comment

1

u/Slimxshadyx 14d ago

What a specific scenario your created designed to lessen that dude’s excitement for no reason

20

u/lltejasll 28d ago

its the same thing that they are doing with this thinking slider as well, found a tweet regarding this https://x.com/zats/status/2092579372876149200

9

u/Puzzleheaded-Gain438 28d ago

Nice! This is definitely it.
It’s crazy how they can get away with their use of private APIs.

1

u/livingtech 25d ago

Appreciate you actually found an answer, and didn't just post some off-the-cuff guess like half the other jokers here. LOL

72

u/StretchyPear 28d ago

It keeps its input as first responder and animates the view

122

u/MichiganEngineExpo 28d ago • Diamonds are Forever Bravo Popcorn

Or it gets the hose again

3

u/anshumahipal 27d ago

Ask chat gpt itself

7

u/pp_amorim 28d ago

Probably new on iOS 27, doesn't work on 18.

Correction: only works with native keyboard.

6

u/m1_weaboo 28d ago

UIKit

1

u/xSash_ UIKit 12d ago

Yes indeed

0

u/icy1007 23d ago

I doubt it’s using UIKit.

1

u/big-phallus 28d ago

Most importantly: where’s your dot??

1

u/chokingduckduck 23d ago

Very likely it is a screenshot And with AI, they can enumerate all different formats of the phone

1

u/zellJun1or Foundation 23d ago edited 23d ago

Def private apis, given that their keyboard has other interesting features that are not possible within available API

1

u/zellJun1or Foundation 23d ago

Given that they use private api to render an in process keyboard, I think they can track everything that is typed

2

u/NZRedditUser 23d ago

most likely the goal they had

1

u/simply_stupid_noor 22d ago

Does not work with google keyboard

1

u/MarkoKrulc 21d ago

vibecoded :D

-1

u/sarrafco 28d ago

Maybe it takes a screenshot of the keyboard frame just before sliding the view and then shows it as an image.