Question: how to connect iphone keyboard to mac?
Answer: Connect your computer to Wi-Fi and download the Touch Mouse Server on your computer (PC or Mac) from Logitech.com/touchmouse.
Connect your iPhone to the same Wi-Fi hot spot and download the Touch Mouse app (iTunes link). ... 
Now you're ready to control your computer with your iPhone.