Question: how to connect iphone to macbook keyboard?
Answer: Click the Bluetooth icon in the customizable Mac Menu Bar and make sure Bluetooth is On.
On your iPhone or iPad, go to Settings > Bluetooth and switch it On too. ... 
On your Mac, click the Bluetooth icon in your menu bar then Open Bluetooth Preferences > Pair.