This feature is introduced by Apple in iOS 11 and it let's you share the wi-fi password to other iPhone with ease.
When you should use this feature?
* If you forgot your home wi-fi password.
* It's very lengthy (strong alphanumeric passwords).
* In case you don't want your friend or guest to know the password to avoid him sharing with others.
* If you want to connect to a friend's Wi-Fi network but nobody at the location can remember the password
What you need to use this feature?
* Someone's already connected iOS or macOS device. Sender Device.
* Your iOS or macOS device. Receiver Device.
* Both sender & receiver device having iOS 11 (or higher) or macOS High Sierra (or higher).
* Both devices have Wi-Fi and Bluetooth toggled on.
If one device doesn't have at least either iOS 11 or macOS High Sierra, it won't work.
How to share WiFi password?
If the above requirements are met, it will work no matter if you have an iPad, iPhone, iPod touch, or Mac computer.
1. Choose the Wi-Fi Network
2. On the iPhone that needs internet access, open up the Wi-Fi settings and select the network you want to connect to. This needs to be the exact same network that the other iPhone is already connected. After you've selected it, the "Enter Password" screen will show up.
3. Unlock the Device Already Connected
4. Move both devices close to each other.
5. You will receive a prompt on the sender device. "Do you want to share the Wi-Fi password for (network name) with (receiver device name)?
6. Tap Share Password button to send it on over to the unconnected iPhone.
7. The password field on the unconnected iPhone will be filled in automatically and the device will instantly connect to the network.
8. Press "Done" on the prompt that's still up on the sender device.
Note:- If you don't trust the person you're sharing a Wi-Fi password to, you should reject permission. While they won't be able to see the password on their device, if it gets stored in their Keychain, they'll be able to view it on their Mac after syncing.