Skip to content

Commit

Permalink
Merge pull request #178 from HanX1ao/dev-fix
Browse files Browse the repository at this point in the history
fix: update typos, fix crash on 13 pro
  • Loading branch information
Alexis Creuzot authored Nov 23, 2022
2 parents 31691f3 + ad16dac commit 4a6f5ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SwiftyGif/NSImage+SwiftyGif.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public extension NSImage {
// time interval per frame
let displayRefreshDelayTime = displayRefreshRates.map { 1 / Float($0) }

// caclulate the time when each frame should be displayed at(start at 0)
// calculate the time when each frame should be displayed at(start at 0)
for i in delays.indices.dropFirst() {
delays[i] += delays[i - 1]
}
Expand Down
10 changes: 6 additions & 4 deletions SwiftyGif/UIImage+SwiftyGif.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,20 @@ public extension UIImage {

// frame numbers per second
var displayRefreshRates = displayRefreshFactors.map { maxFramePerSecond / $0 }

if #available(iOS 10.3, *) {
// Will be 120 on devices with ProMotion display, 60 otherwise.
// Will be 120 on devices with ProMotion display, 60 otherwise.
let maximumFramesPerSecond = UIScreen.main.maximumFramesPerSecond
if maximumFramesPerSecond == 120 {
displayRefreshRates.append(UIScreen.main.maximumFramesPerSecond)
displayRefreshRates.append(maximumFramesPerSecond)
displayRefreshFactors.insert(maximumFramesPerSecond, at: 0)
}
}

// time interval per frame
let displayRefreshDelayTime = displayRefreshRates.map { 1 / Float($0) }

// caclulate the time when each frame should be displayed at(start at 0)
// calculate the time when each frame should be displayed at(start at 0)
for i in delays.indices.dropFirst() {
delays[i] += delays[i - 1]
}
Expand Down

0 comments on commit 4a6f5ba

Please sign in to comment.