Skip to content

Commit

Permalink
Updated README usage sample to cleaner Swift conventions
Browse files Browse the repository at this point in the history
Updated README Usage sample to use implicit returns, and lazy init.
  • Loading branch information
philip-bui committed Feb 18, 2019
1 parent b0bcd1c commit 5be2dd2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ AsYouTypeFormatter.tagAttributes = [NSAttributedString.Key.font: UIFont.boldSyst
AsYouTypeFormatter.mentionAttributes = [NSAttributedString.Key.font: UIFont.italicSystemFont(ofSize: 16)]

// ViewController.swift - Customize own character prefixes and formats.
private var typeFormatter: AsYouTypeFormatter {
let typeFormatter = AsYouTypeFormatter(delegate: self, attributes: [
private lazy var typeFormatter: AsYouTypeFormatter = {
// Implicit return.
AsYouTypeFormatter(delegate: self, attributes: [
"#": [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)],
nil: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)]
])
return typeFormatter
}
}()
```

## Design Decisions
Expand Down

0 comments on commit 5be2dd2

Please sign in to comment.