Set up iCloud Keychain
You can use iCloud to share passwords between your Mac and iOS devices. First, set it up on your iPhone by navigating to Settings > iCloud > Keychain and setting it to On. Choose a passcode by following the on-screen prompts.
On your Mac, go to System Preferences, then iCloud. Check the box next to Keychain. Now choose whether or not to set a password to unlock the screen. Next, you’ll need to type in your Apple ID password. When that’s done, iCloud needs to get verification from the iOS device you just set up. Click Use Code and a passcode will be sent to the iPhone you just set up. Type the code into the box on your Mac to complete the verification.