Skip to content

Commit

Permalink
- updated frame rate on fly
Browse files Browse the repository at this point in the history
- added  frame rate change test to example
  • Loading branch information
Kirow committed May 29, 2019
1 parent cd7ed8f commit 443488b
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 11 deletions.
7 changes: 6 additions & 1 deletion EFCountingLabel/Classes/EFCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public class EFCounter {
public var timingFunction: EFTiming = EFTimingFunction.linear
//works same way as CADisplayLink.frameInterval
//0 - max frame rate
public var refreshRateInterval: Int = 2
public var refreshRateInterval: Int = 2 {
didSet {
guard let timer = timer else { return }
apply(interval: refreshRateInterval, to: timer)
}
}

public var updateBlock: ((CGFloat) -> Void)?
public var completionBlock: (() -> Void)?
Expand Down
4 changes: 4 additions & 0 deletions Example/EFCountingLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
615470077217336459F28548 /* StoryboardButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 615478D55F97750BE62D6350 /* StoryboardButtonViewController.swift */; };
61547605835C3408C93468DF /* CustomTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 615478D4657C10BDDB2930B2 /* CustomTableViewController.swift */; };
6154767B05F9D92C4A3CCD3D /* DynamicFrameRateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6154777F75D51F92326A369C /* DynamicFrameRateViewController.swift */; };
61547AB8DD5A704F70185C87 /* ListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6154772B1F9DBE58D87528C6 /* ListTableViewController.swift */; };
61547FDE291FDA37914D8D74 /* StoryboardLabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 615477C97BA7D1BE03393744 /* StoryboardLabelViewController.swift */; };
88B4CB65271A07819AE9D976 /* Pods_EFCountingLabel_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF702AD45972585A86A336D5 /* Pods_EFCountingLabel_Example.framework */; };
Expand Down Expand Up @@ -48,6 +49,7 @@
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
6154772B1F9DBE58D87528C6 /* ListTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTableViewController.swift; sourceTree = "<group>"; };
6154777F75D51F92326A369C /* DynamicFrameRateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DynamicFrameRateViewController.swift; sourceTree = "<group>"; };
615477C97BA7D1BE03393744 /* StoryboardLabelViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardLabelViewController.swift; sourceTree = "<group>"; };
615478D4657C10BDDB2930B2 /* CustomTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTableViewController.swift; sourceTree = "<group>"; };
615478D55F97750BE62D6350 /* StoryboardButtonViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardButtonViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -159,6 +161,7 @@
615477C97BA7D1BE03393744 /* StoryboardLabelViewController.swift */,
615478D4657C10BDDB2930B2 /* CustomTableViewController.swift */,
29AF0090229EE2CE006A18B4 /* FrameRateViewController.swift */,
6154777F75D51F92326A369C /* DynamicFrameRateViewController.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -352,6 +355,7 @@
615470077217336459F28548 /* StoryboardButtonViewController.swift in Sources */,
61547FDE291FDA37914D8D74 /* StoryboardLabelViewController.swift in Sources */,
61547605835C3408C93468DF /* CustomTableViewController.swift in Sources */,
6154767B05F9D92C4A3CCD3D /* DynamicFrameRateViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 443488b

Please sign in to comment.