Skip to content

Commit

Permalink
Support Xcode 12 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpeschenkov committed Mar 30, 2021
1 parent d6c2ca7 commit 512003b
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode11
osx_image: xcode12

install:
- bundle install
Expand Down
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
#### Fixed for any bug fixes.
```

### 1.2.1
### 1.2.4
#### Added
- Xcode 12 support

### 1.2.1
#### Added
- An ability to add borders
- An ability to make the generated image circle

### 1.2.0

- Implemented builder pattern
#### Added
- Builder pattern

#### Changed
- `LAK` prefix renamed to `LK`

### 1.1.9

- Added Xcode 11 support
#### Added
- Xcode 11 support
6 changes: 3 additions & 3 deletions LetterAvatarKit.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |spec|
spec.name = 'LetterAvatarKit'
spec.ios.deployment_target = '8.0'
spec.ios.deployment_target = '9.0'
spec.tvos.deployment_target = '9.0'
spec.version = '1.2.3'
spec.version = '1.2.4'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/vpeschenkov/LetterAvatarKit'
spec.authors = { 'Viktor Peschenkov' => 'v.peschenkov@gmail.com' }
spec.summary = 'An extension that generates letter-based avatars/placeholders written in Swift'
spec.source = { :git => 'https://github.com/vpeschenkov/LetterAvatarKit.git', :tag => spec.version.to_s }
spec.source_files = 'LetterAvatarKit/*.{h,swift}', 'LetterAvatarKit/Extensions/*.{swift}'
spec.requires_arc = true
spec.framework = 'Foundation', 'UIKit'
spec.framework = 'Foundation', 'UIKit', 'SwiftUI'
spec.swift_version = '5.0'
end
8 changes: 4 additions & 4 deletions LetterAvatarKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = LetterAvatarKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.github.vpeschenkov.LetterAvatarKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -522,9 +522,9 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = LetterAvatarKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.github.vpeschenkov.LetterAvatarKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/vpeschenkov/LetterAvatarKit",
"state": {
"branch": null,
"revision": "218b48b379ec40166b89a048faa62eaa8d206b70",
"version": "1.2.2"
"revision": "41f67ab75f428fee719b31a60cdc795d4b5caeb5",
"version": "1.2.3"
}
}
]
Expand Down
24 changes: 14 additions & 10 deletions LetterAvatarKitTests/Utilities/UIImage+Compare.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ extension UIImage {
guard let image = object as? UIImage else {
return false
}
return compareImages(with: image, tolerance: 0.01)
return compareImages(with: image, tolerance: 0.1)
}

// swiftlint:disable function_body_length
// swiftlint:disable cyclomatic_complexity
open func compareImages(with image: UIImage?, tolerance: CGFloat) -> Bool {
guard let image = image else {
return false
Expand Down Expand Up @@ -92,28 +94,30 @@ extension UIImage {

guard let lhsData = lhs.dataProvider?.data,
let rhsData = rhs.dataProvider?.data else {
return false
return false
}

if lhsData == rhsData {
return true
} else {
guard let lhsPixelsPointer: UnsafePointer<UInt8> = CFDataGetBytePtr(lhsData),
let rhsPixelsPointer: UnsafePointer<UInt8> = CFDataGetBytePtr(rhsData) else {
return false
return false
}
var errorCount = 0
let numberOfPixels = Int(self.size.width * self.size.height * 4)
for i in stride(from: 0, to: numberOfPixels, by: 1) {
if lhsPixelsPointer[i] != rhsPixelsPointer[i] {
errorCount += 1
let error = CGFloat(CGFloat(errorCount) / CGFloat(numberOfPixels))
if error > tolerance {
return false
}
// swiftlint:disable line_length
for i in stride(from: 0, to: numberOfPixels, by: 1) where lhsPixelsPointer[i] != rhsPixelsPointer[i] {
errorCount += 1
let error = CGFloat(CGFloat(errorCount) / CGFloat(numberOfPixels))
if error > tolerance {
return false
}
}
// swiftlint:enable line_length
return true
}
}
// swiftlint:enable cyclomatic_complexity
// swiftlint:enable function_body_length
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
`LetterAvatarKit` is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "LetterAvatarKit", "1.2.3" # Swift 5.0+
pod "LetterAvatarKit", "1.2.4" # Swift 5.0+, Xcode 12
pod "LetterAvatarKit", "1.2.3" # Swift 5.0+, Xcode 11
pod "LetterAvatarKit", "1.1.7" # Swift 4.2
pod "LetterAvatarKit", "1.1.5" # Swift 4.0
```
Expand All @@ -37,7 +38,8 @@ pod "LetterAvatarKit", "1.1.5" # Swift 4.0
Add this to `Cartfile`

```ruby
github "vpeschenkov/LetterAvatarKit" == 1.2.3 # Swift 5.0+
github "vpeschenkov/LetterAvatarKit" == 1.2.4 # Swift 5.0+, Xcode 12
github "vpeschenkov/LetterAvatarKit" == 1.2.3 # Swift 5.0+, Xcode 11
github "vpeschenkov/LetterAvatarKit" == 1.1.7 # Swift 4.2
github "vpeschenkov/LetterAvatarKit" == 1.1.5 # Swift 4.0
```
Expand Down

0 comments on commit 512003b

Please sign in to comment.