-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bda3330
commit 25e1365
Showing
49 changed files
with
1,322 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,11 @@ line_length: | |
type_body_length: | ||
- 150 | ||
- 150 | ||
|
||
identifier_name: | ||
excluded: | ||
- c | ||
- m | ||
- to | ||
- id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
# CHANGELOG | ||
|
||
``` | ||
### Added for new features. | ||
### Changed for changes in existing functionality. | ||
### Deprecated for once-stable features removed in upcoming releases. | ||
### Removed for deprecated features removed in this release. | ||
### Fixed for any bug fixes. | ||
#### Added for new features. | ||
#### Changed for changes in existing functionality. | ||
#### Deprecated for once-stable features removed in upcoming releases. | ||
#### Removed for deprecated features removed in this release. | ||
#### Fixed for any bug fixes. | ||
``` | ||
|
||
### 1.2.0 | ||
|
||
- Implemented builder pattern | ||
|
||
#### Changed | ||
- `LAK` prefix renamed to `LK` | ||
|
||
### 1.1.9 | ||
|
||
- Added Xcode 11 support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// LetterAvatarMaker.swift | ||
// LetterAvatarKit | ||
// | ||
// Copyright 2017 Victor Peschenkov | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// o this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
|
||
import Foundation | ||
|
||
open class LetterAvatarMaker: NSObject { | ||
fileprivate var configuration = LetterAvatarBuilderConfiguration() | ||
} | ||
|
||
extension LetterAvatarMaker: LetterAvatarMakerExtendable { | ||
@discardableResult | ||
public func setSize(_ size: CGSize) -> LetterAvatarMakerExtendable { | ||
configuration.size = size | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setUsername(_ username: String) -> LetterAvatarMakerExtendable { | ||
configuration.username = username | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setSingleLetter(_ singleLetter: Bool) -> LetterAvatarMakerExtendable { | ||
configuration.singleLetter = singleLetter | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setLettersFont(_ lettersFont: UIFont?) -> LetterAvatarMakerExtendable { | ||
configuration.lettersFont = lettersFont | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setLettersColor(_ lettersColor: UIColor) -> LetterAvatarMakerExtendable { | ||
configuration.lettersColor = lettersColor | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setBackgroundColors(_ backgroundColors: [UIColor]) -> LetterAvatarMakerExtendable { | ||
configuration.backgroundColors = backgroundColors | ||
return self | ||
} | ||
|
||
@discardableResult | ||
public func setLettersFontAttributes( | ||
_ lettersFontAttributes: [NSAttributedString.Key: Any]? | ||
) -> LetterAvatarMakerExtendable { | ||
configuration.lettersFontAttributes = lettersFontAttributes | ||
return self | ||
} | ||
|
||
public func build(maker: (LetterAvatarBuilderConfiguration) -> Void) -> UIImage? { | ||
maker(configuration) | ||
return UIImage.makeLetterAvatar(withConfiguration: configuration) | ||
} | ||
|
||
public func build() -> UIImage? { | ||
return UIImage.makeLetterAvatar(withConfiguration: configuration) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LetterAvatarMakerExtendable.swift | ||
// LetterAvatarKit | ||
// | ||
// Copyright 2017 Victor Peschenkov | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// o this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol LetterAvatarMakerExtendable: NSObjectProtocol { | ||
func setSize(_ size: CGSize) -> LetterAvatarMakerExtendable | ||
func setUsername(_ username: String) -> LetterAvatarMakerExtendable | ||
func setSingleLetter(_ singleLetter: Bool) -> LetterAvatarMakerExtendable | ||
func setLettersFont(_ lettersFont: UIFont?) -> LetterAvatarMakerExtendable | ||
func setLettersColor(_ lettersColor: UIColor) -> LetterAvatarMakerExtendable | ||
func setBackgroundColors(_ backgroundColors: [UIColor]) -> LetterAvatarMakerExtendable | ||
func setLettersFontAttributes( | ||
_ lettersFontAttributes: [NSAttributedString.Key: Any]? | ||
) -> LetterAvatarMakerExtendable | ||
func build(maker: (LetterAvatarBuilderConfiguration) -> Void) -> UIImage? | ||
func build() -> UIImage? | ||
} |
Oops, something went wrong.