Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hansemannn/iOS11-PasswordFill-Example

Example showing how to use the PasswordFill API in iOS 11.
https://github.com/hansemannn/iOS11-PasswordFill-Example

example ios11 passwordfill

Last synced: 3 months ago
JSON representation

Example showing how to use the PasswordFill API in iOS 11.

Awesome Lists containing this project

README

        

# πŸ”‘ iOS 11 PasswordFill Example

A quick example showing how to use the PasswordFill API in iOS 11 and Swift 4.

## Prerequisites
* Xcode 9+
* "Associated Domains" capability added to your project's `.entitlements` file (when using own domains)
```xml
com.apple.developer.associated-domains

webcredentials:your-domain.com

```

## Getting Started
In order to make the PasswordFill API work, you need to set the `textContentType` property of
your `UITextField` or `UITextView` to `.username` and `.password`:
```swift
let textField = UITextField(frame: CGRect(x: 20, y: 30, width: 300, height: 40))
textField.backgroundColor = UIColor.lightGray
textField.textContentType = .username
textField.placeholder = "Enter Username ..."

let textField2 = UITextField(frame: CGRect(x: 20, y: 70, width: 300, height: 40))
textField2.backgroundColor = UIColor.lightGray
textField2.textContentType = .password
textField2.placeholder = "Enter Password ..."
textField2.isSecureTextEntry = true
```
Then, create a file called `apple-app-site-association` with the following contents:
```json
{
"webcredentials" : {
"apps" : ["."]
}
}
```
Finally, upload the file to your server and place it into the sub-directory `.well-known`.

That's it!

## Author
Hans KnΓΆchel ([@hansemannnn](https://twitter.com/hansemannnn))