├── .gitignore ├── Screenshots ├── flicker number.gif ├── flicker a float number.gif ├── flicker a format number.gif ├── flicker an integer number.gif └── flicker an attribute number.gif ├── Objective-C ├── FlickerNumber │ ├── ViewController.h │ ├── AppDelegate.h │ ├── DetailViewController.h │ ├── main.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.m │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── DetailViewController.m │ └── Classes │ │ ├── UILabel+FlickerNumber.h │ │ └── UILabel+FlickerNumber.m ├── FlickerNumber.podspec ├── FlickerNumberTests │ ├── Info.plist │ └── FlickerNumberTests.m ├── LICENSE └── FlickerNumber.xcodeproj │ ├── xcshareddata │ └── xcschemes │ │ └── FlickerNumber.xcscheme │ └── project.pbxproj ├── FlickerNumber.xcworkspace └── contents.xcworkspacedata ├── .travis.yml ├── Swift ├── FlickerNumber-Swift.podspec ├── FlickerNumber-Swift │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ListViewController.swift │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── ViewController.swift │ └── UILabel+FlickerNumber.swift ├── FlickerNumber-SwiftTests │ ├── Info.plist │ └── FlickerNumber_SwiftTests.m ├── FlickerNumber-SwiftUITests │ ├── Info.plist │ └── FlickerNumber_SwiftUITests.m ├── LICENSE └── FlickerNumber-Swift.xcodeproj │ ├── xcshareddata │ └── xcschemes │ │ └── FlickerNumber-Swift.xcscheme │ └── project.pbxproj └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.xcworkspace 3 | !default.xcworkspace 4 | xcuserdata/ 5 | 6 | .idea/ 7 | -------------------------------------------------------------------------------- /Screenshots/flicker number.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openboy2012/FlickerNumber/HEAD/Screenshots/flicker number.gif -------------------------------------------------------------------------------- /Screenshots/flicker a float number.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openboy2012/FlickerNumber/HEAD/Screenshots/flicker a float number.gif -------------------------------------------------------------------------------- /Screenshots/flicker a format number.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openboy2012/FlickerNumber/HEAD/Screenshots/flicker a format number.gif -------------------------------------------------------------------------------- /Screenshots/flicker an integer number.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openboy2012/FlickerNumber/HEAD/Screenshots/flicker an integer number.gif -------------------------------------------------------------------------------- /Screenshots/flicker an attribute number.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openboy2012/FlickerNumber/HEAD/Screenshots/flicker an attribute number.gif -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UITableViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FlickerNumber.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/DetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.h 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DetailViewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSDictionary *params; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode8.3 3 | 4 | script: 5 | - xcodebuild -workspace FlickerNumber.xcworkspace -scheme "FlickerNumber" -destination "OS=10.3.1,name=iPhone 7 Plus" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty; 6 | - xcodebuild -workspace FlickerNumber.xcworkspace -scheme "FlickerNumber-Swift" -destination "OS=10.3.1,name=iPhone 7 Plus" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty; 7 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'FlickerNumber' 3 | s.version = '1.1' 4 | s.license = 'MIT' 5 | s.summary = 'Flicker a number like alipay use UILabel category' 6 | s.homepage = 'https://github.com/openboy2012/FlickerNumber' 7 | s.author = { 'DeJohn Dong' => 'dongjia_9251@126.com' } 8 | s.source = { :git => 'https://github.com/openboy2012/FlickerNumber.git', :tag => s.version.to_s} 9 | s.ios.deployment_target = '5.1.1' 10 | s.source_files = 'FlickerNumber/Classes/*.{h,m}' 11 | s.requires_arc = true 12 | s.frameworks = 'UIKit' 13 | end 14 | 15 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'FlickerNumber-Swift' 3 | s.version = '2.0' 4 | s.license = 'MIT' 5 | s.summary = 'Flicker a number like alipay use UILabel category' 6 | s.homepage = 'https://github.com/openboy2012/FlickerNumber' 7 | s.author = { 'DeJohn Dong' => 'dongjia_9251@126.com' } 8 | s.source = { :git => 'https://github.com/openboy2012/FlickerNumber.git', :tag => s.version.to_s} 9 | s.ios.deployment_target = '8.0' 10 | s.source_files = 'FlickerNumber-Swift/FlickerNumber-Swift/UILabel+FlickerNumber.swift' 11 | s.frameworks = 'UIKit' 12 | end 13 | 14 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15/10/23. 6 | // Copyright © 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-SwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-SwiftUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Objective-C/FlickerNumberTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumberTests/FlickerNumberTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FlickerNumberTests.m 3 | // FlickerNumberTests 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface FlickerNumberTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation FlickerNumberTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Objective-C/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 FlickerNumber 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-SwiftTests/FlickerNumber_SwiftTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FlickerNumber_SwiftTests.m 3 | // FlickerNumber-SwiftTests 4 | // 5 | // Created by DeJohn Dong on 2017/7/18. 6 | // Copyright © 2017年 ddkit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FlickerNumber_SwiftTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FlickerNumber_SwiftTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Swift/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 FlickerNumber-Swift 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/ListViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListViewController.swift 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15/11/9. 6 | // Copyright © 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ListViewController : UITableViewController { 12 | 13 | var dataList = ["Flicker An Integer Number", 14 | "Flicker A Float Number", 15 | "Flicker A Format Number", 16 | "Flicker An Attribute Number", 17 | "Flicker An All Number"] 18 | 19 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 20 | segue.destination.title = (sender as! String) 21 | } 22 | 23 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 24 | return dataList.count 25 | } 26 | 27 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 28 | let cell = tableView.dequeueReusableCell(withIdentifier: "typeCell")! 29 | cell.textLabel?.text = dataList[indexPath.row] 30 | return cell 31 | } 32 | 33 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 34 | self.performSegue(withIdentifier: "go2FlickerNumber", sender: dataList[indexPath.row]) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-SwiftUITests/FlickerNumber_SwiftUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FlickerNumber_SwiftUITests.m 3 | // FlickerNumber-SwiftUITests 4 | // 5 | // Created by DeJohn Dong on 2017/7/18. 6 | // Copyright © 2017年 ddkit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FlickerNumber_SwiftUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FlickerNumber_SwiftUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController (){ 12 | NSMutableArray *dataList; 13 | } 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | if(!dataList) 23 | dataList = [[NSMutableArray alloc] init]; 24 | [dataList addObject:@"Flicker An Integer Number"]; 25 | [dataList addObject:@"Flicker A Float Number"]; 26 | [dataList addObject:@"Flicker A Format Number"]; 27 | [dataList addObject:@"Flicker An Attribute Number"]; 28 | [dataList addObject:@"Flicker Number All"]; 29 | } 30 | 31 | - (void)didReceiveMemoryWarning { 32 | [super didReceiveMemoryWarning]; 33 | // Dispose of any resources that can be recreated. 34 | } 35 | 36 | 37 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ 38 | [[segue destinationViewController] setTitle:sender]; 39 | } 40 | 41 | #pragma mark - UITableView DataSource Methods 42 | 43 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 44 | return dataList.count; 45 | } 46 | 47 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 48 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FlickerNumberCell"]; 49 | cell.textLabel.text = dataList[indexPath.row]; 50 | return cell; 51 | } 52 | 53 | #pragma mark - UITableView Delegate Methods 54 | 55 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 56 | return 44.0f; 57 | } 58 | 59 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 60 | [self performSegueWithIdentifier:@"DetailSegue" sender:dataList[indexPath.row]]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | // Override point for customization after application launch. 19 | return YES; 20 | } 21 | 22 | - (void)applicationWillResignActive:(UIApplication *)application { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | - (void)applicationDidEnterBackground:(UIApplication *)application { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | - (void)applicationWillEnterForeground:(UIApplication *)application { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | - (void)applicationWillTerminate:(UIApplication *)application { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber.xcodeproj/xcshareddata/xcschemes/FlickerNumber.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15/10/23. 6 | // Copyright © 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var label : UILabel! 13 | @IBOutlet weak var fnSwitch : UISwitch! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do any additional setup after loading the view, typically from a nib. 18 | // label?.fn_setNumber(1234.1234) 19 | } 20 | 21 | override func viewWillAppear(_ animated: Bool) { 22 | super.viewWillAppear(animated) 23 | self.valueChanged(self.fnSwitch) 24 | } 25 | 26 | @IBAction func valueChanged(_ sender : UISwitch) { 27 | if sender.isOn { 28 | if self.title == "Flicker An Integer Number" { 29 | label?.fn_setNumber(1234442218, formatter: nil) 30 | } else if self.title == "Flicker A Float Number" { 31 | label?.fn_setNumber(123456789.123456, formatter: nil) 32 | } else if self.title == "Flicker A Format Number" { 33 | label?.fn_setNumber(1234512, format:"$%@", formatter: nil) 34 | } else if self.title == "Flicker An Attribute Number" { 35 | let colorDict = [NSAttributedStringKey.foregroundColor: UIColor.red] 36 | let range = NSRange(location: 2, length: 2) 37 | let attribute = NSDictionary.fn_dictionary(colorDict, range: range) 38 | label?.fn_setNumber(12345.212, formatter: nil, attributes: attribute) 39 | } else { 40 | let colorDict = [NSAttributedStringKey.foregroundColor: UIColor.red] 41 | let colorRange = NSRange(location: 1, length: 2) 42 | let colorAttribute = NSDictionary.fn_dictionary(colorDict, range: colorRange) 43 | let fontDict = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 12)] 44 | let fontRange = NSRange(location: 3, length: 4) 45 | let fontAttribute = NSDictionary.fn_dictionary(fontDict, range: fontRange) 46 | let attributes = [colorAttribute, fontAttribute] 47 | let numberFormatter = NumberFormatter() 48 | numberFormatter.numberStyle = .currency 49 | numberFormatter.formatterBehavior = .behavior10_4 50 | label?.fn_setNumber(123456.789, format:"%@", formatter:numberFormatter, attributes: attributes) 51 | } 52 | 53 | } else { 54 | if self.title == "Flicker An Integer Number" { 55 | label?.fn_setNumber(1235566321) 56 | } else if self.title == "Flicker A Float Number" { 57 | label?.fn_setNumber(123456789.123456) 58 | } else if self.title == "Flicker A Format Number" { 59 | label?.fn_setNumber(91, format:"$%.2f") 60 | } else if self.title == "Flicker An Attribute Number" { 61 | let colorDict = [NSAttributedStringKey.foregroundColor: UIColor.red] 62 | let range = NSRange(location: 2, length: 2) 63 | let attribute = NSDictionary.fn_dictionary(colorDict, range: range) 64 | label?.fn_setNumber(48273.38, attributes: attribute) 65 | } else { 66 | let colorDict = [NSAttributedStringKey.foregroundColor: UIColor.red] 67 | let colorRange = NSRange(location: 1, length: 2) 68 | let colorAttribute = NSDictionary.fn_dictionary(colorDict, range: colorRange) 69 | let fontDict = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 12)] 70 | let fontRange = NSRange(location: 3, length: 4) 71 | let fontAttribute = NSDictionary.fn_dictionary(fontDict, range: fontRange) 72 | let attributes = [colorAttribute, fontAttribute] 73 | label?.fn_setNumber(987654.321, format:"¥%.3f", attributes: attributes) 74 | } 75 | } 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/DetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.m 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import "DetailViewController.h" 10 | #import "UILabel+FlickerNumber.h" 11 | 12 | @interface DetailViewController (){ 13 | } 14 | 15 | 16 | @property (nonatomic, weak) IBOutlet UILabel *lblFlicker; 17 | @property (nonatomic, weak) IBOutlet UISwitch *switchOn; 18 | 19 | @end 20 | 21 | @implementation DetailViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view. 26 | } 27 | 28 | - (void)viewWillAppear:(BOOL)animated{ 29 | [super viewWillAppear:animated]; 30 | [self valueChanged:self.switchOn]; 31 | } 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | /* 39 | #pragma mark - Navigation 40 | 41 | // In a storyboard-based application, you will often want to do a little preparation before navigation 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 43 | // Get the new view controller using [segue destinationViewController]. 44 | // Pass the selected object to the new view controller. 45 | } 46 | */ 47 | 48 | - (IBAction)valueChanged:(id)sender{ 49 | if([(UISwitch *)sender isOn]){ 50 | if([self.title isEqualToString:@"Flicker An Integer Number"]){ 51 | [self.lblFlicker fn_setNumber:@(88075998) formatter:nil]; 52 | }else if([self.title isEqualToString:@"Flicker A Float Number"]){ 53 | [self.lblFlicker fn_setNumber:@(123456789.123456) formatter:nil]; 54 | }else if([self.title isEqualToString:@"Flicker A Format Number"]){ 55 | [self.lblFlicker fn_setNumber:@(9123.1234) format:@"¥%@" formatter:nil]; 56 | }else if([self.title isEqualToString:@"Flicker An Attribute Number"]){ 57 | id attributes = [NSDictionary fn_dictionaryWithAttribute:@{NSForegroundColorAttributeName:[UIColor redColor]} 58 | range:NSMakeRange(0, 1)]; 59 | [self.lblFlicker fn_setNumber:@(1888.88) formatter:nil attributes:attributes]; 60 | }else{ 61 | id attributes = @[[NSDictionary fn_dictionaryWithAttribute:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f]} 62 | range:NSMakeRange(0, 1)], 63 | [NSDictionary fn_dictionaryWithAttribute:@{NSForegroundColorAttributeName:[UIColor redColor]} 64 | range:NSMakeRange(1, 3)]]; 65 | NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; 66 | formatter.formatterBehavior = NSNumberFormatterBehavior10_4; 67 | formatter.numberStyle = NSNumberFormatterDecimalStyle; 68 | [self.lblFlicker fn_setNumber:@(1234.567) duration:1.0f format:@"¥%@" numberFormatter:formatter attributes:attributes]; 69 | } 70 | }else{ 71 | if([self.title isEqualToString:@"Flicker An Integer Number"]){ 72 | [self.lblFlicker fn_setNumber:@(88075998)]; 73 | }else if([self.title isEqualToString:@"Flicker A Float Number"]){ 74 | [self.lblFlicker fn_setNumber:@(987654321.987654)]; 75 | }else if([self.title isEqualToString:@"Flicker A Format Number"]){ 76 | [self.lblFlicker fn_setNumber:@(12345.7231) format:@"¥%d"]; 77 | }else if([self.title isEqualToString:@"Flicker An Attribute Number"]){ 78 | id attributes = [NSDictionary fn_dictionaryWithAttribute:@{NSForegroundColorAttributeName:[UIColor redColor]} 79 | range:NSMakeRange(0, 1)]; 80 | [self.lblFlicker fn_setNumber:@(1888.88) attributes:attributes]; 81 | }else{ 82 | id attributes = @[[NSDictionary fn_dictionaryWithAttribute:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f]} 83 | range:NSMakeRange(0, 1)], 84 | [NSDictionary fn_dictionaryWithAttribute:@{NSForegroundColorAttributeName:[UIColor redColor]} 85 | range:NSMakeRange(1, 3)]]; 86 | [self.lblFlicker fn_setNumber:@(1234.567) duration:-0.1f format:@"¥%.2f" attributes:attributes]; 87 | } 88 | } 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift.xcodeproj/xcshareddata/xcschemes/FlickerNumber-Swift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Classes/UILabel+FlickerNumber.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+FlickerNumber.h 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UILabel (FlickerNumber) 14 | 15 | /** 16 | * Flicker a number without other effects. 17 | * 18 | * @param number The number for flicker animation, can't be `nil`. 19 | */ 20 | - (void)fn_setNumber:(NSNumber *)number; 21 | 22 | /** 23 | * Flicker a number with number-formatter style. You can use the `NSNumberFormatterCurrencyStyle` number-formatter style, the number will flicker animation as `$1,023.12`. 24 | * 25 | * @param number The number for flicker animation. 26 | * @param formatter The number-formatter style. If this parameter is `nil`, the method should use the default number-formatter style -- `NSNumberFormatterDecimalStyle`, so `1000000` will be '1,000,000'. 27 | */ 28 | - (void)fn_setNumber:(NSNumber *)number 29 | formatter:(nullable NSNumberFormatter *)formatter; 30 | 31 | /** 32 | * Flicker a number in during time. 33 | * 34 | * @param number The number for flicker animation. 35 | * @param duration The flicker animation during time, can't be a minus. 36 | */ 37 | - (void)fn_setNumber:(NSNumber *)number 38 | duration:(NSTimeInterval)duration; 39 | 40 | /** 41 | * Flicker a number in during time with number-formatter style. 42 | * 43 | * @param number The number for flicker animation. 44 | * @param duration The flicker animation during time. 45 | * @param formatter The number-formatter style. 46 | */ 47 | - (void)fn_setNumber:(NSNumber *)number 48 | duration:(NSTimeInterval)duration 49 | formatter:(nullable NSNumberFormatter *)formatter; 50 | 51 | /** 52 | * Flicker a number with string-format style. like this: `Today's income: $200.00`. 53 | * 54 | * @param number The number for flicker animation. 55 | * @param formatStr The string-format String. If you set this parameter is `nil`, the method is same to `fn_setNumber:`. 56 | */ 57 | - (void)fn_setNumber:(NSNumber *)number 58 | format:(nullable NSString *)formatStr; 59 | 60 | /** 61 | * Flicker a number with string-format String & number-formatter style. 62 | * 63 | * @param number The number for flicker animation. 64 | * @param formatStr The string-format String. 65 | * @param formatter The number-formatter style. 66 | */ 67 | - (void)fn_setNumber:(NSNumber *)number 68 | format:(nullable NSString *)formatStr 69 | formatter:(nullable NSNumberFormatter *)formatter; 70 | 71 | 72 | /** 73 | * Flicker a number with attributed(s) property. 74 | * 75 | * @param number The number for flicker animation. 76 | * @param attrs The attributed number set(a dictionary OR array of dictionaries), character attributes for text. Only can attributed the number because there are no string-format String. Use this parameter the number text can be colorful and wonderful. If you set this parameter is `nil`, the same to method `fn_setNumber:`. 77 | */ 78 | - (void)fn_setNumber:(NSNumber *)number 79 | attributes:(nullable id)attrs; 80 | 81 | /** 82 | * Flicker a number with number-formatter style & attributed(s) property. 83 | * 84 | * @param number The number for flicker animation. 85 | * @param formatter The number-formatter style. 86 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 87 | */ 88 | - (void)fn_setNumber:(NSNumber *)number 89 | formatter:(nullable NSNumberFormatter *)formatter 90 | attributes:(nullable id)attrs; 91 | 92 | /** 93 | * Flicker a number with string-format String & attributed(s) property. 94 | * 95 | * @param number The number for flicker animation. 96 | * @param formatStr The string-format String. 97 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). You can attributed(s) the number or string-format String. 98 | */ 99 | - (void)fn_setNumber:(NSNumber *)number 100 | format:(nullable NSString *)formatStr 101 | attributes:(nullable id)attrs; 102 | 103 | /** 104 | * Flicker a number in dafault during time(1.0s) with all effects. 105 | * 106 | * @param number The number for flicker animation. 107 | * @param formatStr The string-format String. 108 | * @param formatter The number-formatter style. 109 | * @param attrs The attributed string set(a dictionary OR array of dictionaries).You can attributed(s) the number or string-format String. 110 | */ 111 | - (void)fn_setNumber:(NSNumber *)number 112 | format:(nullable NSString *)formatStr 113 | formatter:(nullable NSNumberFormatter *)formatter 114 | attributes:(nullable id)attrs; 115 | 116 | /** 117 | * Flicker a number in during time with string-format String. 118 | * 119 | * @param number The number for flicker animation. 120 | * @param duration The flicker animation during time. 121 | * @param formatStr The string-format String. 122 | */ 123 | - (void)fn_setNumber:(NSNumber *)number 124 | duration:(NSTimeInterval)duration 125 | format:(nullable NSString *)formatStr; 126 | 127 | /** 128 | * Flicker a number in during time with string-format String & number-formatter style. 129 | * 130 | * @param number The number for flicker animation. 131 | * @param duration The flicker animation during time. 132 | * @param formatStr The string-format String. 133 | * @param formatter The number-formatter style. 134 | */ 135 | - (void)fn_setNumber:(NSNumber *)number 136 | duration:(NSTimeInterval)duration 137 | format:(nullable NSString *)formatStr 138 | formatter:(nullable NSNumberFormatter *)formatter; 139 | 140 | /** 141 | * Flicker a number in during time with attributed(s) property. 142 | * 143 | * @param number The number for flicker animation. 144 | * @param duration The flicker animation during time. 145 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 146 | */ 147 | - (void)fn_setNumber:(NSNumber *)number 148 | duration:(NSTimeInterval)duration 149 | attributes:(nullable id)attrs; 150 | 151 | /** 152 | * Flicker a number in during time with attributed(s) property of number & number-formatter style. 153 | * 154 | * @param number The number for flicker animation. 155 | * @param duration The flicker animation during time. 156 | * @param formatter The number-formatter style. 157 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 158 | */ 159 | - (void)fn_setNumber:(NSNumber *)number 160 | duration:(NSTimeInterval)duration 161 | formatter:(nullable NSNumberFormatter *)formatter 162 | attributes:(nullable id)attrs; 163 | 164 | /** 165 | * Flicker a number in during time with effects except number-formatter style. 166 | * 167 | * @param number The number for flicker animation. 168 | * @param duration The flicker animation during time. 169 | * @param formatStr The string-format String. 170 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). You can set string-format String OR number attributes both. 171 | */ 172 | - (void)fn_setNumber:(NSNumber *)number 173 | duration:(NSTimeInterval)duration 174 | format:(nullable NSString *)formatStr 175 | attributes:(nullable id)attrs; 176 | 177 | /** 178 | * Flicker a number in during time with all the effects. You can attributed(s) the number or string-format String. You also can set the number number-fomatter style. 179 | * 180 | * @param number The number for flicker animation. 181 | * @param duration The flicker animation during time. 182 | * @param formatStr The string-format String. 183 | * @param formatter The number-formatter style. 184 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). 185 | */ 186 | - (void)fn_setNumber:(NSNumber *)number 187 | duration:(NSTimeInterval)duration 188 | format:(nullable NSString *)formatStr 189 | numberFormatter:(nullable NSNumberFormatter *)formatter 190 | attributes:(nullable id)attrs; 191 | 192 | @end 193 | 194 | @interface UILabel (FlickerNumberDeprecated) 195 | 196 | #pragma clang diagnostic push 197 | #pragma clang diagnostic ignored "-Wnonnull" 198 | 199 | - (void)dd_setNumber:(NSNumber *)number __deprecated_msg("Use `fn_setNumber:`"); 200 | - (void)dd_setNumber:(NSNumber *)number formatter:(NSNumberFormatter *)formatter __deprecated_msg("Use `fn_setNumber:formatter:`"); 201 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration __deprecated_msg("Use `fn_setNumber:duration:`"); 202 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(NSNumberFormatter *)formatter __deprecated_msg("Use `fn_setNumber:duration:formatter:"); 203 | - (void)dd_setNumber:(NSNumber *)number format:(NSString *)formatStr __deprecated_msg("Use `fn_setNumber:format:`"); 204 | - (void)dd_setNumber:(NSNumber *)number format:(NSString *)formatStr formatter:(NSNumberFormatter *)formatter __deprecated_msg("Use `fn_setNumber:format:formatter:`"); 205 | - (void)dd_setNumber:(NSNumber *)number attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:attributes:`"); 206 | - (void)dd_setNumber:(NSNumber *)number formatter:(NSNumberFormatter *)formatter attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:formatter:attributes:`"); 207 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr __deprecated_msg("Use `fn_setNumber:duration:format:`"); 208 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr formatter:(NSNumberFormatter *)formatter __deprecated_msg("Use `fn_setNumber:duration:format:formatter:`"); 209 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:duration:attributes:`"); 210 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(NSNumberFormatter *)formatter attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:duration:formatter:attributes:`"); 211 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:duration:format:attributes:`"); 212 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr numberFormatter:(NSNumberFormatter *)formatter attributes:(id)attrs __deprecated_msg("Use `fn_setNumber:duration:format:formatter:attributes:`"); 213 | 214 | #pragma clang diagnostic pop 215 | 216 | @end 217 | 218 | @interface NSDictionary(FlickerNumber) 219 | 220 | /** 221 | * Create an attribute texts dictionary, like the NSAttributedString. 222 | * 223 | * @param attribute The attributed text of the dictionary. 224 | * @param range The range of the attributed text. 225 | * 226 | * @return Dictionary of attributed text. 227 | */ 228 | + (instancetype)fn_dictionaryWithAttribute:(NSDictionary *)attribute range:(NSRange)range; 229 | 230 | @end 231 | 232 | @interface NSDictionary (FlickerNumberDeprecated) 233 | 234 | + (instancetype)dictionaryWithAttribute:(NSDictionary *)attribute range:(NSRange)range __deprecated_msg("Use `fn_dictionaryWithAttribute:range:`"); 235 | 236 | @end 237 | 238 | NS_ASSUME_NONNULL_END 239 | 240 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FlickerNumber 2 | Flicker a number like alipay use UILabel category. It can be wonderful when use the advanced method. 3 | 4 | ## Swift Compatibility 5 | Now, Version 1.0 is coding by Objective-C and Version 2.0 is coding by Swift. 6 | Version 2.1 compatibility the Swift 3.0. 7 | 8 | ## Effects 9 | 10 | 11 | 12 | 13 | 14 | 15 | ## Installation 16 | 17 | [![Build Status](https://travis-ci.org/openboy2012/FlickerNumber.svg?branch=master)](https://travis-ci.org/openboy2012/FlickerNumber) 18 | [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/openboy2012/FlickerNumber/master/LICENSE)  19 | [![codebeat badge](https://codebeat.co/badges/47972caa-32b3-4296-8fc5-9061f0ebe87d)](https://codebeat.co/projects/github-com-openboy2012-flickernumber-master) 20 | ### Code for Objective-C 21 | [![Version](http://cocoapod-badges.herokuapp.com/v/FlickerNumber/badge.png)](http://cocoadocs.org/docsets/FlickerNumber/)  [![Platform](http://cocoapod-badges.herokuapp.com/p/FlickerNumber/badge.png)](http://cocoadocs.org/docsets/FlickerNumber/) [![Support](https://img.shields.io/badge/support-iOS%206.0%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/) 22 | ### Code for Swift 23 | [![Version](http://cocoapod-badges.herokuapp.com/v/FlickerNumber-Swift/badge.png)](http://cocoadocs.org/docsets/FlickerNumber-Swift/)  [![Platform](http://cocoapod-badges.herokuapp.com/p/FlickerNumber-Swift/badge.png)](http://cocoadocs.org/docsets/FlickerNumber-Swift/) [![Support](https://img.shields.io/badge/support-iOS%209.0%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)  24 | 25 | FlickerNumber is available through [CocoaPods](http://cocoapods.org), to install 26 | it simply add the following line to your Podfile: 27 | 28 | pod "FlickerNumber" 29 | Alternatively, you can just drag the files from `FlickerNumber / Classes` into your own project. 30 | 31 | ## Usage 32 | 33 | To run the example project; clone the repo, and run `pod install` from the Project directory first. 34 | 35 | import `UILabel+FlickerNumber.h` in your project 36 | 37 | then you can use the category methods in any initilized UILabel to implement the effect of flicker number. 38 | 39 | for example: 40 | ```objective-c 41 | @property (nonatomic, weak) IBOutlet UILabel *lblFlicker; //for a xib label 42 | 43 | - (void)viewWillAppear:(BOOL)animated{ 44 | [super viewWillAppear:animated]; 45 | 46 | if([self.title isEqualToString:@"Flicker A Integer Number"]){ 47 | [self.lblFlicker fn_setNumber:@(7654321)]; 48 | }else if([self.title isEqualToString:@"Flicker A Float Number"]){ 49 | [self.lblFlicker fn_setNumber:@(123.982)]; 50 | }else if([self.title isEqualToString:@"Flicker A Format Number"]){ 51 | [self.lblFlicker fn_setNumber:@(75.212) format:@"¥%.2f"]; 52 | }else if([self.title isEqualToString:@"Flicker A Attribute Number"]){ 53 | id attributes = [NSDictionary dictionaryWithAttribute:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f]} 54 | range:NSMakeRange(0, 1)]; 55 | [self.lblFlicker fn_setNumber:@(123.45) attributes:attributes]; 56 | }else{ 57 | id attributes = @[[NSDictionary dictionaryWithAttribute:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f]} 58 | range:NSMakeRange(0, 1)], 59 | [NSDictionary dictionaryWithAttribute:@{NSForegroundColorAttributeName:[UIColor redColor]} 60 | range:NSMakeRange(1, 3)]]; 61 | [self.lblFlicker fn_setNumber:@(123.45) duration:1.0f format:@"¥%.2f" attributes:attributes]; 62 | } 63 | } 64 | 65 | ``` 66 | 67 | ## Methods 68 | ```objective-c 69 | /** 70 | * Flicker a number without other effects. 71 | * 72 | * @param number The number for flicker animation, can't be `nil`. 73 | */ 74 | - (void)fn_setNumber:(NSNumber *)number; 75 | 76 | /** 77 | * Flicker a number with number-formatter style. You can use the `NSNumberFormatterCurrencyStyle` number-formatter style, the number will flicker animation as `$1,023.12`. 78 | * 79 | * @param number The number for flicker animation. 80 | * @param formatter The number-formatter style. If this parameter is `nil`, the method should use the default number-formatter style -- `NSNumberFormatterDecimalStyle`, so `1000000` will be '1,000,000'. 81 | */ 82 | - (void)fn_setNumber:(NSNumber *)number 83 | formatter:(nullable NSNumberFormatter *)formatter; 84 | 85 | /** 86 | * Flicker a number in during time. 87 | * 88 | * @param number The number for flicker animation. 89 | * @param duration The flicker animation during time, can't be a minus. 90 | */ 91 | - (void)fn_setNumber:(NSNumber *)number 92 | duration:(NSTimeInterval)duration; 93 | 94 | /** 95 | * Flicker a number in during time with number-formatter style. 96 | * 97 | * @param number The number for flicker animation. 98 | * @param duration The flicker animation during time. 99 | * @param formatter The number-formatter style. 100 | */ 101 | - (void)fn_setNumber:(NSNumber *)number 102 | duration:(NSTimeInterval)duration 103 | formatter:(nullable NSNumberFormatter *)formatter; 104 | 105 | /** 106 | * Flicker a number with string-format style. like this: `Today's income: $200.00`. 107 | * 108 | * @param number The number for flicker animation. 109 | * @param formatStr The string-format String. If you set this parameter is `nil`, the method is same to `fn_setNumber:`. 110 | */ 111 | - (void)fn_setNumber:(NSNumber *)number 112 | format:(nullable NSString *)formatStr; 113 | 114 | /** 115 | * Flicker a number with string-format String & number-formatter style. 116 | * 117 | * @param number The number for flicker animation. 118 | * @param formatStr The string-format String. 119 | * @param formatter The number-formatter style. 120 | */ 121 | - (void)fn_setNumber:(NSNumber *)number 122 | format:(nullable NSString *)formatStr 123 | formatter:(nullable NSNumberFormatter *)formatter; 124 | 125 | 126 | /** 127 | * Flicker a number with attributed(s) property. 128 | * 129 | * @param number The number for flicker animation. 130 | * @param attrs The attributed number set(a dictionary OR array of dictionaries), character attributes for text. Only can attributed the number because there are no string-format String. Use this parameter the number text can be colorful and wonderful. If you set this parameter is `nil`, the same to method `fn_setNumber:`. 131 | */ 132 | - (void)fn_setNumber:(NSNumber *)number 133 | attributes:(nullable id)attrs; 134 | 135 | /** 136 | * Flicker a number with number-formatter style & attributed(s) property. 137 | * 138 | * @param number The number for flicker animation. 139 | * @param formatter The number-formatter style. 140 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 141 | */ 142 | - (void)fn_setNumber:(NSNumber *)number 143 | formatter:(nullable NSNumberFormatter *)formatter 144 | attributes:(nullable id)attrs; 145 | 146 | /** 147 | * Flicker a number with string-format String & attributed(s) property. 148 | * 149 | * @param number The number for flicker animation. 150 | * @param formatStr The string-format String. 151 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). You can attributed(s) the number or string-format String. 152 | */ 153 | - (void)fn_setNumber:(NSNumber *)number 154 | format:(nullable NSString *)formatStr 155 | attributes:(nullable id)attrs; 156 | 157 | /** 158 | * Flicker a number in dafault during time(1.0s) with all effects. 159 | * 160 | * @param number The number for flicker animation. 161 | * @param formatStr The string-format String. 162 | * @param formatter The number-formatter style. 163 | * @param attrs The attributed string set(a dictionary OR array of dictionaries).You can attributed(s) the number or string-format String. 164 | */ 165 | - (void)fn_setNumber:(NSNumber *)number 166 | format:(nullable NSString *)formatStr 167 | formatter:(nullable NSNumberFormatter *)formatter 168 | attributes:(nullable id)attrs; 169 | 170 | /** 171 | * Flicker a number in during time with string-format String. 172 | * 173 | * @param number The number for flicker animation. 174 | * @param duration The flicker animation during time. 175 | * @param formatStr The string-format String. 176 | */ 177 | - (void)fn_setNumber:(NSNumber *)number 178 | duration:(NSTimeInterval)duration 179 | format:(nullable NSString *)formatStr; 180 | 181 | /** 182 | * Flicker a number in during time with string-format String & number-formatter style. 183 | * 184 | * @param number The number for flicker animation. 185 | * @param duration The flicker animation during time. 186 | * @param formatStr The string-format String. 187 | * @param formatter The number-formatter style. 188 | */ 189 | - (void)fn_setNumber:(NSNumber *)number 190 | duration:(NSTimeInterval)duration 191 | format:(nullable NSString *)formatStr 192 | formatter:(nullable NSNumberFormatter *)formatter; 193 | 194 | /** 195 | * Flicker a number in during time with attributed(s) property. 196 | * 197 | * @param number The number for flicker animation. 198 | * @param duration The flicker animation during time. 199 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 200 | */ 201 | - (void)fn_setNumber:(NSNumber *)number 202 | duration:(NSTimeInterval)duration 203 | attributes:(nullable id)attrs; 204 | 205 | /** 206 | * Flicker a number in during time with attributed(s) property of number & number-formatter style. 207 | * 208 | * @param number The number for flicker animation. 209 | * @param duration The flicker animation during time. 210 | * @param formatter The number-formatter style. 211 | * @param attrs The attributed number set(a dictionary OR array of dictionaries). 212 | */ 213 | - (void)fn_setNumber:(NSNumber *)number 214 | duration:(NSTimeInterval)duration 215 | formatter:(nullable NSNumberFormatter *)formatter 216 | attributes:(nullable id)attrs; 217 | 218 | /** 219 | * Flicker a number in during time with effects except number-formatter style. 220 | * 221 | * @param number The number for flicker animation. 222 | * @param duration The flicker animation during time. 223 | * @param formatStr The string-format String. 224 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). You can set string-format String OR number attributes both. 225 | */ 226 | - (void)fn_setNumber:(NSNumber *)number 227 | duration:(NSTimeInterval)duration 228 | format:(nullable NSString *)formatStr 229 | attributes:(nullable id)attrs; 230 | 231 | /** 232 | * Flicker a number in during time with all the effects. You can attributed(s) the number or string-format String. You also can set the number number-fomatter style. 233 | * 234 | * @param number The number for flicker animation. 235 | * @param duration The flicker animation during time. 236 | * @param formatStr The string-format String. 237 | * @param formatter The number-formatter style. 238 | * @param attrs The attributed string set(a dictionary OR array of dictionaries). 239 | */ 240 | - (void)fn_setNumber:(NSNumber *)number 241 | duration:(NSTimeInterval)duration 242 | format:(nullable NSString *)formatStr 243 | numberFormatter:(nullable NSNumberFormatter *)formatter 244 | attributes:(nullable id)attrs; 245 | 246 | ``` 247 | 248 | ## Updates 249 | - [2.1] compatibility the Swift 3.0. 250 | - [2.0] the flicker number for swift. 251 | - [1.1] rename the method then they are more memorise. 252 | - [1.0] add the long long type integer or double number flicker function. 253 | - [0.2] add the NSNumberFormatter function. 254 | - [0.1] add the flicker number kit. 255 | 256 | ## Requirements 257 | Objective-C Version: 258 | - Xcode 7.1 259 | - iOS 6.0 260 | 261 | Swift Version: 262 | - Xcode 8.3 263 | - iOS 9.0 264 | 265 | ## Author 266 | 267 | DeJohn Dong, dongjia_9251@126.com 268 | 269 | ## License 270 | 271 | FlickerNumber is available under the MIT license. See the LICENSE file for more info. 272 | 273 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber/Classes/UILabel+FlickerNumber.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+FlickerNumber.m 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15-2-1. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import "UILabel+FlickerNumber.h" 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #define DDRangeIntegerKey @"RangeKey" 15 | #define DDMultipleKey @"MultipleKey" 16 | #define DDBeginNumberKey @"BeginNumberKey" 17 | #define DDEndNumberKey @"EndNumberKey" 18 | #define DDResultNumberKey @"ResultNumberKey" 19 | 20 | #define DDAttributeKey @"AttributeKey" 21 | #define DDFormatKey @"FormatStringKey" 22 | 23 | #define DDFrequency 1.0/30.0f 24 | 25 | #define DDDictArrtributeKey @"attribute" 26 | #define DDDictRangeKey @"range" 27 | 28 | @interface UILabel () 29 | 30 | @property (nonatomic, strong, readwrite) NSNumber *flickerNumber; 31 | @property (nonatomic, strong, readwrite, nullable) NSNumberFormatter *flickerNumberFormatter; 32 | @property (nonatomic, strong, readwrite, nullable) NSTimer *currentTimer; 33 | 34 | @end 35 | 36 | @implementation UILabel (FlickerNumber) 37 | 38 | #pragma mark - runtime methods 39 | 40 | - (void)setFlickerNumber:(NSNumber *)flickerNumber { 41 | objc_setAssociatedObject(self, @selector(flickerNumber), flickerNumber, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 42 | } 43 | 44 | - (NSNumber *)flickerNumber { 45 | return objc_getAssociatedObject(self, _cmd); 46 | } 47 | 48 | - (void)setFlickerNumberFormatter:(nullable NSNumberFormatter *)flickerNumberFormatter { 49 | objc_setAssociatedObject(self, @selector(flickerNumberFormatter), flickerNumberFormatter, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 50 | } 51 | 52 | - (nullable NSNumberFormatter *)flickerNumberFormatter { 53 | return objc_getAssociatedObject(self, _cmd); 54 | } 55 | 56 | - (void)setCurrentTimer:(nullable NSTimer *)currentTimer { 57 | objc_setAssociatedObject(self, @selector(currentTimer), currentTimer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 58 | } 59 | 60 | - (nullable NSTimer *)currentTimer { 61 | return objc_getAssociatedObject(self, _cmd); 62 | } 63 | 64 | #pragma mark - flicker methods(public) 65 | 66 | //Method #1 67 | - (void)fn_setNumber:(NSNumber *)number { 68 | [self fn_setNumber:number format:nil]; 69 | } 70 | 71 | //Method #2 72 | - (void)fn_setNumber:(NSNumber *)number formatter:(nullable NSNumberFormatter *)formatter { 73 | [self fn_setNumber:number formatter:formatter attributes:nil]; 74 | } 75 | 76 | //Method #3 77 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration { 78 | [self fn_setNumber:number duration:duration format:nil attributes:nil]; 79 | } 80 | 81 | //Method #4 82 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(nullable NSNumberFormatter *)formatter{ 83 | [self fn_setNumber:number duration:duration formatter:formatter attributes:nil]; 84 | } 85 | 86 | //Method #5 87 | - (void)fn_setNumber:(NSNumber *)number format:(nullable NSString *)formatStr { 88 | [self fn_setNumber:number format:formatStr attributes:nil]; 89 | } 90 | 91 | //Method #6 92 | - (void)fn_setNumber:(NSNumber *)number format:(nullable NSString *)formatStr formatter:(nullable NSNumberFormatter *)formatter { 93 | [self fn_setNumber:number format:formatStr formatter:formatter attributes:nil]; 94 | } 95 | 96 | //Method #7 97 | - (void)fn_setNumber:(NSNumber *)number attributes:(nullable id)attrs { 98 | [self fn_setNumber:number format:nil attributes:attrs]; 99 | } 100 | 101 | //Method #8 102 | - (void)fn_setNumber:(NSNumber *)number formatter:(nullable NSNumberFormatter *)formatter attributes:(nullable id)attrs { 103 | [self fn_setNumber:number duration:1.0 format:nil numberFormatter:formatter attributes:attrs]; 104 | } 105 | 106 | //Method #9 107 | - (void)fn_setNumber:(NSNumber *)number format:(nullable NSString *)formatStr attributes:(nullable id)attrs { 108 | [self fn_setNumber:number duration:1.0 format:formatStr attributes:attrs]; 109 | } 110 | 111 | //Method #10 112 | - (void)fn_setNumber:(NSNumber *)number format:(nullable NSString *)formatStr formatter:(nullable NSNumberFormatter *)formatter attributes:(nullable id)attrs { 113 | if(!formatter) { 114 | formatter = [self defaultFormatter]; 115 | } 116 | [self fn_setNumber:number duration:1.0 format:formatStr numberFormatter:formatter attributes:attrs]; 117 | } 118 | 119 | //Method #11 120 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(nullable NSString *)formatStr { 121 | [self fn_setNumber:number duration:duration format:formatStr attributes:nil]; 122 | } 123 | 124 | //Method #12 125 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(nullable NSString *)formatStr formatter:(nullable NSNumberFormatter *)formatter { 126 | if(!formatter) 127 | formatter = [self defaultFormatter]; 128 | [self fn_setNumber:number duration:duration format:formatStr formatter:formatter]; 129 | } 130 | 131 | //Method #13 132 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration attributes:(nullable id)attrs { 133 | [self fn_setNumber:number duration:duration format:nil attributes:attrs]; 134 | } 135 | 136 | //Method #14 137 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(nullable NSNumberFormatter *)formatter attributes:(nullable id)attrs { 138 | if(!formatter) 139 | formatter = [self defaultFormatter]; 140 | [self fn_setNumber:number duration:duration format:nil numberFormatter:formatter attributes:attrs]; 141 | } 142 | 143 | //Method #15 144 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(nullable NSString *)formatStr attributes:(nullable id)attrs { 145 | [self fn_setNumber:number duration:duration format:formatStr numberFormatter:nil attributes:attrs]; 146 | } 147 | 148 | //Method #16 149 | - (void)fn_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(nullable NSString *)formatStr numberFormatter:(nullable NSNumberFormatter *)formatter attributes:(nullable id)attrs { 150 | /** 151 | * check the number type 152 | */ 153 | NSAssert([number isKindOfClass:[NSNumber class]], @"Number Type is not matched , exit"); 154 | if(![number isKindOfClass:[NSNumber class]]) { 155 | self.text = [NSString stringWithFormat:@"%@",number]; 156 | return; 157 | } 158 | 159 | /* limit duration is postive number and it is large than 0.3 , fixed the issue#1--https://github.com/openboy2012/FlickerNumber/issues/1 */ 160 | duration = fabs(duration) < 0.3 ? 0.3 : fabs(duration); 161 | 162 | [self.currentTimer invalidate]; 163 | self.currentTimer = nil; 164 | 165 | //initialize useinfo dict 166 | NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:0]; 167 | 168 | if(formatStr) 169 | [userInfo setObject:formatStr forKey:DDFormatKey]; 170 | 171 | [userInfo setObject:number forKey:DDResultNumberKey]; 172 | 173 | //initialize variables 174 | long long beginNumber = 0; 175 | [userInfo setObject:@(beginNumber) forKey:DDBeginNumberKey]; 176 | self.flickerNumber = @0; 177 | unsigned long long endNumber = [number unsignedLongLongValue]; 178 | 179 | //get multiple if number is double type 180 | int multiple = [self getTheMultipleFromNumber:number formatString:formatStr]; 181 | if (multiple > 0) 182 | endNumber = [number doubleValue] * multiple; 183 | 184 | //check the number if out of bounds the unsigned int length 185 | if (endNumber >= INT64_MAX) { 186 | self.text = [NSString stringWithFormat:@"%@",number]; 187 | return; 188 | } 189 | 190 | [userInfo setObject:@(multiple) forKey:DDMultipleKey]; 191 | [userInfo setObject:@(endNumber) forKey:DDEndNumberKey]; 192 | if ((endNumber * DDFrequency)/duration < 1) { 193 | duration = duration * 0.3; 194 | } 195 | [userInfo setObject:@((endNumber * DDFrequency)/duration) forKey:DDRangeIntegerKey]; 196 | 197 | if(attrs) 198 | [userInfo setObject:attrs forKey:DDAttributeKey]; 199 | 200 | self.flickerNumberFormatter = nil; 201 | if(formatter) 202 | self.flickerNumberFormatter = formatter; 203 | 204 | self.currentTimer = [NSTimer scheduledTimerWithTimeInterval:DDFrequency target:self selector:@selector(flickerAnimation:) userInfo:userInfo repeats:YES]; 205 | [[NSRunLoop currentRunLoop] addTimer:self.currentTimer forMode:NSRunLoopCommonModes]; 206 | } 207 | 208 | #pragma mark - private methods 209 | /** 210 | * Flicker number animation implemetation method. 211 | * 212 | * @param timer The schedule timer, the time interval decide the number flicker counts. 213 | */ 214 | - (void)flickerAnimation:(NSTimer *)timer { 215 | /** 216 | * check the rangeNumber if more than 1.0, fixed the issue#2--https://github.com/openboy2012/FlickerNumber/issues/2 217 | */ 218 | if ([timer.userInfo[DDRangeIntegerKey] floatValue] >= 1.0) { 219 | long long rangeInteger = [timer.userInfo[DDRangeIntegerKey] longLongValue]; 220 | self.flickerNumber = @([self.flickerNumber longLongValue] + rangeInteger); 221 | } else { 222 | float rangeInteger = [timer.userInfo[DDRangeIntegerKey] floatValue]; 223 | self.flickerNumber = @([self.flickerNumber floatValue] + rangeInteger); 224 | } 225 | 226 | 227 | int multiple = [timer.userInfo[DDMultipleKey] intValue]; 228 | if (multiple > 0) { 229 | [self floatNumberAnimation:timer multiple:multiple]; 230 | } else { 231 | NSString *formatStr = timer.userInfo[DDFormatKey]?:(self.flickerNumberFormatter?@"%@":@"%.0f"); 232 | self.text = [self finalString:@([self.flickerNumber longLongValue]) stringFormat:formatStr numberFormatter:self.flickerNumberFormatter]; 233 | 234 | if (timer.userInfo[DDAttributeKey]) { 235 | [self addTextAttributes:timer.userInfo[DDAttributeKey]]; 236 | } 237 | 238 | if ([self.flickerNumber longLongValue] >= [timer.userInfo[DDEndNumberKey] longLongValue]) { 239 | self.text = [self finalString:timer.userInfo[DDResultNumberKey] stringFormat:formatStr numberFormatter:self.flickerNumberFormatter]; 240 | if (timer.userInfo[DDAttributeKey]) { 241 | [self addTextAttributes:timer.userInfo[DDAttributeKey]]; 242 | } 243 | [timer invalidate]; 244 | } 245 | } 246 | } 247 | 248 | /** 249 | * Float number handle method. 250 | * 251 | * @param timer timer 252 | * @param multiple The number's multiple. 253 | */ 254 | - (void)floatNumberAnimation:(NSTimer *)timer multiple:(int)multiple { 255 | NSString *formatStr = timer.userInfo[DDFormatKey] ?: (self.flickerNumberFormatter ? @"%@" : [NSString stringWithFormat:@"%%.%df",(int)log10(multiple)]); 256 | self.text = [self finalString:@([self.flickerNumber doubleValue]/multiple) stringFormat:formatStr numberFormatter:self.flickerNumberFormatter]; 257 | if (timer.userInfo[DDAttributeKey]) { 258 | [self addTextAttributes:timer.userInfo[DDAttributeKey]]; 259 | } 260 | if ([self.flickerNumber longLongValue] >= [timer.userInfo[DDEndNumberKey] longLongValue]) { 261 | self.text = [self finalString:timer.userInfo[DDResultNumberKey] stringFormat:formatStr numberFormatter:self.flickerNumberFormatter]; 262 | if (timer.userInfo[DDAttributeKey]) { 263 | [self addTextAttributes:timer.userInfo[DDAttributeKey]]; 264 | } 265 | [timer invalidate]; 266 | } 267 | } 268 | 269 | /** 270 | * The attributed(s) text handle methods 271 | * 272 | * @param attributes The attributed property, it's a attributed dictionary OR array of attributed dictionaries. 273 | */ 274 | - (void)addTextAttributes:(id)attributes { 275 | if ([attributes isKindOfClass:[NSDictionary class]]) { 276 | NSRange range = [attributes[DDDictRangeKey] rangeValue]; 277 | [self addAttribute:attributes[DDDictArrtributeKey] range:range]; 278 | } else if([attributes isKindOfClass:[NSArray class]]) { 279 | for (NSDictionary *attribute in attributes) { 280 | NSRange range = [attribute[DDDictRangeKey] rangeValue]; 281 | [self addAttribute:attribute[DDDictArrtributeKey] range:range]; 282 | } 283 | } 284 | } 285 | 286 | /** 287 | * Add attributed property into the number text OR string-format text. 288 | * 289 | * @param attri The attributed of the text 290 | * @param range The range of the attributed property 291 | */ 292 | - (void)addAttribute:(NSDictionary *)attri 293 | range:(NSRange)range { 294 | NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText]; 295 | // handler the out range exception 296 | if(range.location + range.length <= str.length){ 297 | [str addAttributes:attri range:range]; 298 | } 299 | self.attributedText = str; 300 | } 301 | 302 | /** 303 | * Get muliple from number 304 | * 305 | * @param number past number 306 | * 307 | * @return mulitple 308 | */ 309 | - (int)getTheMultipleFromNumber:(NSNumber *)number 310 | formatString:(NSString *)formatStr { 311 | if([formatStr rangeOfString:@"%@"].location == NSNotFound) { 312 | if([formatStr rangeOfString:@"%d"].location != NSNotFound) { 313 | return 0; 314 | } 315 | formatStr = [self regexNumberFormat:formatStr]; 316 | NSString *formatNumberString = [NSString stringWithFormat:formatStr,[number floatValue]]; 317 | if ([formatNumberString rangeOfString:@"."].location != NSNotFound) { 318 | NSUInteger length = [[formatNumberString substringFromIndex:[formatNumberString rangeOfString:@"."].location + 1] length]; 319 | float padding = log10f(length < 6 ? length:6); 320 | number = @([formatNumberString floatValue] + padding); 321 | } 322 | } 323 | 324 | NSString *str = [NSString stringWithFormat:@"%@",number]; 325 | if([str rangeOfString:@"."].location != NSNotFound) { 326 | NSUInteger length = [[str substringFromIndex:[str rangeOfString:@"."].location +1] length]; 327 | // Max Multiple is 6 328 | return length >= 6 ? pow(10, 6): pow(10, (int)length); 329 | } 330 | return 0; 331 | } 332 | 333 | /** 334 | * Get the number string from number-formatter style. 335 | * 336 | * @param number The result number. 337 | * @param formattor The number-formatter style. 338 | * 339 | * @return The number string. 340 | */ 341 | - (NSString *)stringFromNumber:(NSNumber *)number 342 | numberFormatter:(NSNumberFormatter *)formattor { 343 | if(!formattor) { 344 | formattor = [[NSNumberFormatter alloc] init]; 345 | formattor.formatterBehavior = NSNumberFormatterBehavior10_4; 346 | formattor.numberStyle = NSNumberFormatterDecimalStyle; 347 | } 348 | return [formattor stringFromNumber:number]; 349 | } 350 | 351 | /** 352 | * The final-string of each frame of flicker animation. 353 | * 354 | * @param number The result number. 355 | * @param formatStr The string-format String. 356 | * @param formatter The number-formatter style. 357 | * 358 | * @return The final string. 359 | */ 360 | - (NSString *)finalString:(NSNumber *)number 361 | stringFormat:(NSString *)formatStr 362 | numberFormatter:(NSNumberFormatter *)formatter { 363 | NSString *finalString = nil; 364 | if (formatter) { 365 | NSAssert([formatStr rangeOfString:@"%@"].location != NSNotFound, @"The string format type is not matched. Please check your format type if it's not `%%@`. "); 366 | finalString = [NSString stringWithFormat:formatStr,[self stringFromNumber:number numberFormatter:formatter]]; 367 | } else { 368 | NSAssert([formatStr rangeOfString:@"%@"].location == NSNotFound, @"The string format type is not matched. Please check your format type if it's `%%@`. "); 369 | // fixed the bug if use the `%d` format string. 370 | if ([formatStr rangeOfString:@"%d"].location == NSNotFound) 371 | { 372 | finalString = [NSString stringWithFormat:formatStr,[number doubleValue]]; 373 | } 374 | else 375 | { 376 | finalString = [NSString stringWithFormat:formatStr,[number longLongValue]]; 377 | } 378 | } 379 | return finalString; 380 | } 381 | 382 | /** 383 | * Get the decimal style number as default number-formatter style. 384 | * 385 | * @return The number-foramtter style. 386 | */ 387 | - (NSNumberFormatter *)defaultFormatter { 388 | NSNumberFormatter *formattor = [[NSNumberFormatter alloc] init]; 389 | formattor.formatterBehavior = NSNumberFormatterBehavior10_4; 390 | formattor.numberStyle = NSNumberFormatterDecimalStyle; 391 | return formattor; 392 | } 393 | 394 | /** 395 | * Get the format string use regex feature. This methods to handle the number is an integer number but it should string format as a float number, like this `self.text = [NSString stringFormat:@"%f",1234]`, it's show `1234.000000`. 396 | * 397 | * @param formatString The origin string 398 | * 399 | * @return The string-format String. 400 | */ 401 | - (NSString *)regexNumberFormat:(NSString *)formatString { 402 | NSError *regexError = nil; 403 | NSRegularExpression *regex = 404 | [NSRegularExpression regularExpressionWithPattern:@"^%((\\d+.\\d+)|(\\d+).|(.\\d+))f$" 405 | options:NSRegularExpressionCaseInsensitive 406 | error:®exError]; 407 | if (!regexError) { 408 | NSTextCheckingResult *match = [regex firstMatchInString:formatString 409 | options:0 410 | range:NSMakeRange(0, [formatString length])]; 411 | if (match) { 412 | NSString *result = [formatString substringWithRange:match.range]; 413 | return result; 414 | } 415 | } else { 416 | NSLog(@"error - %@", regexError); 417 | } 418 | return @"%f"; 419 | } 420 | 421 | @end 422 | 423 | @implementation UILabel (FlickerNumberDeprecated) 424 | 425 | - (void)dd_setNumber:(NSNumber *)number { 426 | [self fn_setNumber:number format:nil]; 427 | } 428 | 429 | - (void)dd_setNumber:(NSNumber *)number formatter:(NSNumberFormatter *)formatter { 430 | [self fn_setNumber:number format:nil formatter:formatter]; 431 | } 432 | 433 | - (void)dd_setNumber:(NSNumber *)number format:(NSString *)formatStr { 434 | [self fn_setNumber:number format:formatStr]; 435 | } 436 | 437 | - (void)dd_setNumber:(NSNumber *)number format:(NSString *)formatStr formatter:(NSNumberFormatter *)formatter { 438 | [self fn_setNumber:number format:formatStr formatter:formatter]; 439 | } 440 | 441 | - (void)dd_setNumber:(NSNumber *)number attributes:(id)attrs { 442 | [self fn_setNumber:number attributes:attrs]; 443 | } 444 | 445 | - (void)dd_setNumber:(NSNumber *)number formatter:(NSNumberFormatter *)formatter attributes:(id)attrs { 446 | [self fn_setNumber:number formatter:formatter attributes:attrs]; 447 | } 448 | 449 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr { 450 | [self fn_setNumber:number duration:duration format:formatStr]; 451 | } 452 | 453 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr numberFormatter:(NSNumberFormatter *)formatter { 454 | [self fn_setNumber:number duration:duration format:formatStr formatter:formatter]; 455 | } 456 | 457 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration { 458 | [self fn_setNumber:number duration:duration]; 459 | } 460 | 461 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(NSNumberFormatter *)formatter { 462 | [self fn_setNumber:number duration:duration formatter:formatter]; 463 | } 464 | 465 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration attributes:(id)attrs { 466 | [self fn_setNumber:number duration:duration attributes:attrs]; 467 | } 468 | 469 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr formatter:(NSNumberFormatter *)formatter { 470 | [self fn_setNumber:number duration:duration format:formatStr formatter:formatter]; 471 | } 472 | 473 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration formatter:(NSNumberFormatter *)formatter attributes:(id)attrs { 474 | [self fn_setNumber:number duration:duration formatter:formatter attributes:attrs]; 475 | } 476 | 477 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr attributes:(id)attrs { 478 | [self fn_setNumber:number duration:duration format:formatStr attributes:attrs]; 479 | } 480 | 481 | - (void)dd_setNumber:(NSNumber *)number duration:(NSTimeInterval)duration format:(NSString *)formatStr numberFormatter:(NSNumberFormatter *)formatter attributes:(id)attrs { 482 | [self fn_setNumber:number duration:duration format:formatStr numberFormatter:formatter attributes:attrs]; 483 | } 484 | 485 | @end 486 | 487 | @implementation NSDictionary (FlickerNumber) 488 | 489 | + (instancetype)fn_dictionaryWithAttribute:(NSDictionary *)attribute range:(NSRange)range { 490 | NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0]; 491 | [dict setObject:attribute forKey:DDDictArrtributeKey]; 492 | [dict setObject:[NSValue valueWithRange:range] forKey:DDDictRangeKey]; 493 | return dict; 494 | } 495 | 496 | @end 497 | 498 | @implementation NSDictionary (FlickerNumberDeprecated) 499 | 500 | + (instancetype)dictionaryWithAttribute:(NSDictionary *)attribute range:(NSRange)range { 501 | NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0]; 502 | [dict setObject:attribute forKey:DDDictArrtributeKey]; 503 | [dict setObject:[NSValue valueWithRange:range] forKey:DDDictRangeKey]; 504 | return dict; 505 | } 506 | 507 | @end 508 | 509 | NS_ASSUME_NONNULL_END 510 | 511 | -------------------------------------------------------------------------------- /Objective-C/FlickerNumber.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8E1944FF1A7E4138007AFF77 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1944FE1A7E4138007AFF77 /* main.m */; }; 11 | 8E1945021A7E4138007AFF77 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1945011A7E4138007AFF77 /* AppDelegate.m */; }; 12 | 8E1945051A7E4138007AFF77 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1945041A7E4138007AFF77 /* ViewController.m */; }; 13 | 8E1945081A7E4138007AFF77 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8E1945061A7E4138007AFF77 /* Main.storyboard */; }; 14 | 8E19450A1A7E4138007AFF77 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8E1945091A7E4138007AFF77 /* Images.xcassets */; }; 15 | 8E19450D1A7E4138007AFF77 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E19450B1A7E4138007AFF77 /* LaunchScreen.xib */; }; 16 | 8E1945191A7E4138007AFF77 /* FlickerNumberTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1945181A7E4138007AFF77 /* FlickerNumberTests.m */; }; 17 | 8E19452C1A7E41E3007AFF77 /* UILabel+FlickerNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E19452B1A7E41E3007AFF77 /* UILabel+FlickerNumber.m */; }; 18 | 8E19452F1A7E653D007AFF77 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E19452E1A7E653D007AFF77 /* DetailViewController.m */; }; 19 | 8E4DB75E1AA692DD001B2206 /* FlickerNumber.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 8E4DB75D1AA692DD001B2206 /* FlickerNumber.podspec */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 8E1945131A7E4138007AFF77 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 8E1944F11A7E4138007AFF77 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 8E1944F81A7E4138007AFF77; 28 | remoteInfo = FlickerNumber; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 8E1944F91A7E4138007AFF77 /* FlickerNumber.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FlickerNumber.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 8E1944FD1A7E4138007AFF77 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 8E1944FE1A7E4138007AFF77 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 8E1945001A7E4138007AFF77 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 8E1945011A7E4138007AFF77 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 8E1945031A7E4138007AFF77 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | 8E1945041A7E4138007AFF77 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | 8E1945071A7E4138007AFF77 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 8E1945091A7E4138007AFF77 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | 8E19450C1A7E4138007AFF77 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | 8E1945121A7E4138007AFF77 /* FlickerNumberTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlickerNumberTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 8E1945171A7E4138007AFF77 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 8E1945181A7E4138007AFF77 /* FlickerNumberTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlickerNumberTests.m; sourceTree = ""; }; 46 | 8E19452A1A7E41E3007AFF77 /* UILabel+FlickerNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+FlickerNumber.h"; sourceTree = ""; }; 47 | 8E19452B1A7E41E3007AFF77 /* UILabel+FlickerNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+FlickerNumber.m"; sourceTree = ""; }; 48 | 8E19452D1A7E653D007AFF77 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; 49 | 8E19452E1A7E653D007AFF77 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; 50 | 8E4DB75D1AA692DD001B2206 /* FlickerNumber.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FlickerNumber.podspec; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 8E1944F61A7E4138007AFF77 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 8E19450F1A7E4138007AFF77 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 8E1944F01A7E4138007AFF77 = { 72 | isa = PBXGroup; 73 | children = ( 74 | 8E4DB75D1AA692DD001B2206 /* FlickerNumber.podspec */, 75 | 8E1944FB1A7E4138007AFF77 /* FlickerNumber */, 76 | 8E1945151A7E4138007AFF77 /* FlickerNumberTests */, 77 | 8E1944FA1A7E4138007AFF77 /* Products */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | 8E1944FA1A7E4138007AFF77 /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 8E1944F91A7E4138007AFF77 /* FlickerNumber.app */, 85 | 8E1945121A7E4138007AFF77 /* FlickerNumberTests.xctest */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | 8E1944FB1A7E4138007AFF77 /* FlickerNumber */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 8E1945291A7E41E3007AFF77 /* Classes */, 94 | 8E1945001A7E4138007AFF77 /* AppDelegate.h */, 95 | 8E1945011A7E4138007AFF77 /* AppDelegate.m */, 96 | 8E1945031A7E4138007AFF77 /* ViewController.h */, 97 | 8E1945041A7E4138007AFF77 /* ViewController.m */, 98 | 8E19452D1A7E653D007AFF77 /* DetailViewController.h */, 99 | 8E19452E1A7E653D007AFF77 /* DetailViewController.m */, 100 | 8E1945061A7E4138007AFF77 /* Main.storyboard */, 101 | 8E1945091A7E4138007AFF77 /* Images.xcassets */, 102 | 8E19450B1A7E4138007AFF77 /* LaunchScreen.xib */, 103 | 8E1944FC1A7E4138007AFF77 /* Supporting Files */, 104 | ); 105 | path = FlickerNumber; 106 | sourceTree = ""; 107 | }; 108 | 8E1944FC1A7E4138007AFF77 /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 8E1944FD1A7E4138007AFF77 /* Info.plist */, 112 | 8E1944FE1A7E4138007AFF77 /* main.m */, 113 | ); 114 | name = "Supporting Files"; 115 | sourceTree = ""; 116 | }; 117 | 8E1945151A7E4138007AFF77 /* FlickerNumberTests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 8E1945181A7E4138007AFF77 /* FlickerNumberTests.m */, 121 | 8E1945161A7E4138007AFF77 /* Supporting Files */, 122 | ); 123 | path = FlickerNumberTests; 124 | sourceTree = ""; 125 | }; 126 | 8E1945161A7E4138007AFF77 /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 8E1945171A7E4138007AFF77 /* Info.plist */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | 8E1945291A7E41E3007AFF77 /* Classes */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 8E19452A1A7E41E3007AFF77 /* UILabel+FlickerNumber.h */, 138 | 8E19452B1A7E41E3007AFF77 /* UILabel+FlickerNumber.m */, 139 | ); 140 | path = Classes; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 8E1944F81A7E4138007AFF77 /* FlickerNumber */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 8E19451C1A7E4138007AFF77 /* Build configuration list for PBXNativeTarget "FlickerNumber" */; 149 | buildPhases = ( 150 | 8E1944F51A7E4138007AFF77 /* Sources */, 151 | 8E1944F61A7E4138007AFF77 /* Frameworks */, 152 | 8E1944F71A7E4138007AFF77 /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = FlickerNumber; 159 | productName = FlickerNumber; 160 | productReference = 8E1944F91A7E4138007AFF77 /* FlickerNumber.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | 8E1945111A7E4138007AFF77 /* FlickerNumberTests */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 8E19451F1A7E4138007AFF77 /* Build configuration list for PBXNativeTarget "FlickerNumberTests" */; 166 | buildPhases = ( 167 | 8E19450E1A7E4138007AFF77 /* Sources */, 168 | 8E19450F1A7E4138007AFF77 /* Frameworks */, 169 | 8E1945101A7E4138007AFF77 /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | 8E1945141A7E4138007AFF77 /* PBXTargetDependency */, 175 | ); 176 | name = FlickerNumberTests; 177 | productName = FlickerNumberTests; 178 | productReference = 8E1945121A7E4138007AFF77 /* FlickerNumberTests.xctest */; 179 | productType = "com.apple.product-type.bundle.unit-test"; 180 | }; 181 | /* End PBXNativeTarget section */ 182 | 183 | /* Begin PBXProject section */ 184 | 8E1944F11A7E4138007AFF77 /* Project object */ = { 185 | isa = PBXProject; 186 | attributes = { 187 | LastSwiftUpdateCheck = 0710; 188 | LastUpgradeCheck = 0700; 189 | ORGANIZATIONNAME = DDKit; 190 | TargetAttributes = { 191 | 8E1944F81A7E4138007AFF77 = { 192 | CreatedOnToolsVersion = 6.1.1; 193 | DevelopmentTeam = F76XM9QFY9; 194 | }; 195 | 8E1945111A7E4138007AFF77 = { 196 | CreatedOnToolsVersion = 6.1.1; 197 | TestTargetID = 8E1944F81A7E4138007AFF77; 198 | }; 199 | }; 200 | }; 201 | buildConfigurationList = 8E1944F41A7E4138007AFF77 /* Build configuration list for PBXProject "FlickerNumber" */; 202 | compatibilityVersion = "Xcode 3.2"; 203 | developmentRegion = English; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | Base, 208 | ); 209 | mainGroup = 8E1944F01A7E4138007AFF77; 210 | productRefGroup = 8E1944FA1A7E4138007AFF77 /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | 8E1944F81A7E4138007AFF77 /* FlickerNumber */, 215 | 8E1945111A7E4138007AFF77 /* FlickerNumberTests */, 216 | ); 217 | }; 218 | /* End PBXProject section */ 219 | 220 | /* Begin PBXResourcesBuildPhase section */ 221 | 8E1944F71A7E4138007AFF77 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 8E1945081A7E4138007AFF77 /* Main.storyboard in Resources */, 226 | 8E19450D1A7E4138007AFF77 /* LaunchScreen.xib in Resources */, 227 | 8E4DB75E1AA692DD001B2206 /* FlickerNumber.podspec in Resources */, 228 | 8E19450A1A7E4138007AFF77 /* Images.xcassets in Resources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | 8E1945101A7E4138007AFF77 /* Resources */ = { 233 | isa = PBXResourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXResourcesBuildPhase section */ 240 | 241 | /* Begin PBXSourcesBuildPhase section */ 242 | 8E1944F51A7E4138007AFF77 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 8E19452F1A7E653D007AFF77 /* DetailViewController.m in Sources */, 247 | 8E19452C1A7E41E3007AFF77 /* UILabel+FlickerNumber.m in Sources */, 248 | 8E1945051A7E4138007AFF77 /* ViewController.m in Sources */, 249 | 8E1945021A7E4138007AFF77 /* AppDelegate.m in Sources */, 250 | 8E1944FF1A7E4138007AFF77 /* main.m in Sources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | 8E19450E1A7E4138007AFF77 /* Sources */ = { 255 | isa = PBXSourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | 8E1945191A7E4138007AFF77 /* FlickerNumberTests.m in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXSourcesBuildPhase section */ 263 | 264 | /* Begin PBXTargetDependency section */ 265 | 8E1945141A7E4138007AFF77 /* PBXTargetDependency */ = { 266 | isa = PBXTargetDependency; 267 | target = 8E1944F81A7E4138007AFF77 /* FlickerNumber */; 268 | targetProxy = 8E1945131A7E4138007AFF77 /* PBXContainerItemProxy */; 269 | }; 270 | /* End PBXTargetDependency section */ 271 | 272 | /* Begin PBXVariantGroup section */ 273 | 8E1945061A7E4138007AFF77 /* Main.storyboard */ = { 274 | isa = PBXVariantGroup; 275 | children = ( 276 | 8E1945071A7E4138007AFF77 /* Base */, 277 | ); 278 | name = Main.storyboard; 279 | sourceTree = ""; 280 | }; 281 | 8E19450B1A7E4138007AFF77 /* LaunchScreen.xib */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | 8E19450C1A7E4138007AFF77 /* Base */, 285 | ); 286 | name = LaunchScreen.xib; 287 | sourceTree = ""; 288 | }; 289 | /* End PBXVariantGroup section */ 290 | 291 | /* Begin XCBuildConfiguration section */ 292 | 8E19451A1A7E4138007AFF77 /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ALWAYS_SEARCH_USER_PATHS = NO; 296 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 297 | CLANG_CXX_LIBRARY = "libc++"; 298 | CLANG_ENABLE_MODULES = YES; 299 | CLANG_ENABLE_OBJC_ARC = YES; 300 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_COMMA = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 305 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 306 | CLANG_WARN_EMPTY_BODY = YES; 307 | CLANG_WARN_ENUM_CONVERSION = YES; 308 | CLANG_WARN_INFINITE_RECURSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 311 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 312 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 313 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 314 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 315 | CLANG_WARN_STRICT_PROTOTYPES = YES; 316 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 317 | CLANG_WARN_UNREACHABLE_CODE = YES; 318 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 319 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 320 | COPY_PHASE_STRIP = NO; 321 | ENABLE_STRICT_OBJC_MSGSEND = YES; 322 | ENABLE_TESTABILITY = YES; 323 | GCC_C_LANGUAGE_STANDARD = gnu99; 324 | GCC_DYNAMIC_NO_PIC = NO; 325 | GCC_NO_COMMON_BLOCKS = YES; 326 | GCC_OPTIMIZATION_LEVEL = 0; 327 | GCC_PREPROCESSOR_DEFINITIONS = ( 328 | "DEBUG=1", 329 | "$(inherited)", 330 | ); 331 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 332 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 333 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 334 | GCC_WARN_UNDECLARED_SELECTOR = YES; 335 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 336 | GCC_WARN_UNUSED_FUNCTION = YES; 337 | GCC_WARN_UNUSED_VARIABLE = YES; 338 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 339 | MTL_ENABLE_DEBUG_INFO = YES; 340 | ONLY_ACTIVE_ARCH = YES; 341 | SDKROOT = iphoneos; 342 | }; 343 | name = Debug; 344 | }; 345 | 8E19451B1A7E4138007AFF77 /* Release */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ALWAYS_SEARCH_USER_PATHS = NO; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 354 | CLANG_WARN_BOOL_CONVERSION = YES; 355 | CLANG_WARN_COMMA = YES; 356 | CLANG_WARN_CONSTANT_CONVERSION = YES; 357 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 358 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 359 | CLANG_WARN_EMPTY_BODY = YES; 360 | CLANG_WARN_ENUM_CONVERSION = YES; 361 | CLANG_WARN_INFINITE_RECURSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 364 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 365 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 368 | CLANG_WARN_STRICT_PROTOTYPES = YES; 369 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 370 | CLANG_WARN_UNREACHABLE_CODE = YES; 371 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 372 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 373 | COPY_PHASE_STRIP = YES; 374 | ENABLE_NS_ASSERTIONS = NO; 375 | ENABLE_STRICT_OBJC_MSGSEND = YES; 376 | GCC_C_LANGUAGE_STANDARD = gnu99; 377 | GCC_NO_COMMON_BLOCKS = YES; 378 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 379 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 380 | GCC_WARN_UNDECLARED_SELECTOR = YES; 381 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 382 | GCC_WARN_UNUSED_FUNCTION = YES; 383 | GCC_WARN_UNUSED_VARIABLE = YES; 384 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 385 | MTL_ENABLE_DEBUG_INFO = NO; 386 | SDKROOT = iphoneos; 387 | VALIDATE_PRODUCT = YES; 388 | }; 389 | name = Release; 390 | }; 391 | 8E19451D1A7E4138007AFF77 /* Debug */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 395 | CLANG_ENABLE_MODULES = YES; 396 | DEVELOPMENT_TEAM = F76XM9QFY9; 397 | INFOPLIST_FILE = FlickerNumber/Info.plist; 398 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 400 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)"; 401 | PRODUCT_NAME = "$(TARGET_NAME)"; 402 | SWIFT_OBJC_BRIDGING_HEADER = "FlickerNumber/Classes/FlickerNumber-Bridging-Header.h"; 403 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 404 | }; 405 | name = Debug; 406 | }; 407 | 8E19451E1A7E4138007AFF77 /* Release */ = { 408 | isa = XCBuildConfiguration; 409 | buildSettings = { 410 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 411 | CLANG_ENABLE_MODULES = YES; 412 | DEVELOPMENT_TEAM = F76XM9QFY9; 413 | INFOPLIST_FILE = FlickerNumber/Info.plist; 414 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 415 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 416 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | SWIFT_OBJC_BRIDGING_HEADER = "FlickerNumber/Classes/FlickerNumber-Bridging-Header.h"; 419 | }; 420 | name = Release; 421 | }; 422 | 8E1945201A7E4138007AFF77 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | BUNDLE_LOADER = "$(TEST_HOST)"; 426 | FRAMEWORK_SEARCH_PATHS = ( 427 | "$(SDKROOT)/Developer/Library/Frameworks", 428 | "$(inherited)", 429 | ); 430 | GCC_PREPROCESSOR_DEFINITIONS = ( 431 | "DEBUG=1", 432 | "$(inherited)", 433 | ); 434 | INFOPLIST_FILE = FlickerNumberTests/Info.plist; 435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 436 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FlickerNumber.app/FlickerNumber"; 439 | }; 440 | name = Debug; 441 | }; 442 | 8E1945211A7E4138007AFF77 /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | BUNDLE_LOADER = "$(TEST_HOST)"; 446 | FRAMEWORK_SEARCH_PATHS = ( 447 | "$(SDKROOT)/Developer/Library/Frameworks", 448 | "$(inherited)", 449 | ); 450 | INFOPLIST_FILE = FlickerNumberTests/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)"; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FlickerNumber.app/FlickerNumber"; 455 | }; 456 | name = Release; 457 | }; 458 | /* End XCBuildConfiguration section */ 459 | 460 | /* Begin XCConfigurationList section */ 461 | 8E1944F41A7E4138007AFF77 /* Build configuration list for PBXProject "FlickerNumber" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 8E19451A1A7E4138007AFF77 /* Debug */, 465 | 8E19451B1A7E4138007AFF77 /* Release */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | 8E19451C1A7E4138007AFF77 /* Build configuration list for PBXNativeTarget "FlickerNumber" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 8E19451D1A7E4138007AFF77 /* Debug */, 474 | 8E19451E1A7E4138007AFF77 /* Release */, 475 | ); 476 | defaultConfigurationIsVisible = 0; 477 | defaultConfigurationName = Release; 478 | }; 479 | 8E19451F1A7E4138007AFF77 /* Build configuration list for PBXNativeTarget "FlickerNumberTests" */ = { 480 | isa = XCConfigurationList; 481 | buildConfigurations = ( 482 | 8E1945201A7E4138007AFF77 /* Debug */, 483 | 8E1945211A7E4138007AFF77 /* Release */, 484 | ); 485 | defaultConfigurationIsVisible = 0; 486 | defaultConfigurationName = Release; 487 | }; 488 | /* End XCConfigurationList section */ 489 | }; 490 | rootObject = 8E1944F11A7E4138007AFF77 /* Project object */; 491 | } 492 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift/UILabel+FlickerNumber.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+FlickerNumber.swift 3 | // FlickerNumber 4 | // 5 | // Created by DeJohn Dong on 15/10/23. 6 | // Copyright © 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | private let rangeIntegerName = "rangeInteger" 13 | private let multipleName = "multiple" 14 | private let beginNumberName = "beginNumber" 15 | private let endNumberName = "endNumber" 16 | private let resultNumberName = "resultNumber" 17 | private let attributeName = "attribute" 18 | private let formatName = "format" 19 | private let frequency = 1.0/30.0 20 | 21 | extension UILabel { 22 | /** 23 | Flicker a number without other effects. 24 | 25 | - parameter number: The number for flicker animation, can't be `nil`. 26 | */ 27 | public func fn_setNumber(_ number: NSNumber) { 28 | self.fn_setNumber(number, format: nil) 29 | } 30 | 31 | /** 32 | Flicker a number with number-formatter style. You can use the `NSNumberFormatterCurrencyStyle` number-formatter style, the number will flicker animation as `$1,023.12`. 33 | 34 | - parameter number: The number for flicker animation. 35 | - parameter formatter: The number-formatter style. If this parameter is `nil`, the method should use the default number-formatter style -- `NSNumberFormatterDecimalStyle`, so `1000000` will be '1,000,000'. 36 | */ 37 | public func fn_setNumber(_ number: NSNumber, formatter: NumberFormatter?) { 38 | self.fn_setNumber(number, formatter:formatter, attributes: nil) 39 | } 40 | 41 | /** 42 | Flicker a number in during time. 43 | 44 | - parameter number: The number for flicker animation. 45 | - parameter duration: The flicker animation during time, can't be a minus. 46 | */ 47 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval) { 48 | self.fn_setNumber(number, duration: duration, format: nil) 49 | } 50 | 51 | /** 52 | Flicker a number in during time with number-formatter style. 53 | 54 | - parameter number: The number for flicker animation. 55 | - parameter duration: The flicker animation during time. 56 | - parameter formatter: The number-formatter style. 57 | */ 58 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, formatter: NumberFormatter?) { 59 | self.fn_setNumber(number, duration: duration, formatter: formatter, attributes: nil) 60 | } 61 | 62 | /** 63 | Flicker a number with string-format style. like this: `Today's income: $200.00`. 64 | 65 | - parameter number: The number for flicker animation. 66 | - parameter format: The string-format String. If you set this parameter is `nil`, the method is same to `fn_setNumber:`. 67 | */ 68 | public func fn_setNumber(_ number: NSNumber, format: String?) { 69 | self.fn_setNumber(number, format: format, attributes: nil) 70 | } 71 | 72 | /** 73 | Flicker a number with string-format String & number-formatter style. 74 | 75 | - parameter number: The number for flicker animation. 76 | - parameter format: The string-format String. 77 | - parameter formatter: The number-formatter style. 78 | */ 79 | public func fn_setNumber(_ number: NSNumber, format: String?, formatter: NumberFormatter?) { 80 | self.fn_setNumber(number, format: format, formatter: formatter, attributes: nil) 81 | } 82 | 83 | /** 84 | Flicker a number with attributed(s) property. 85 | 86 | - parameter number: The number for flicker animation. 87 | - parameter attributes: The attributed number set(a dictionary OR array of dictionaries), character attributes for text. Only can attributed the number because there are no string-format String. Use this parameter the number text can be colorful and wonderful. If you set this parameter is `nil`, the same to method `fn_setNumber:`. 88 | */ 89 | public func fn_setNumber(_ number: NSNumber, attributes: Any?) { 90 | self.fn_setNumber(number, duration: 1.0, attributes: attributes) 91 | } 92 | 93 | /** 94 | Flicker a number with number-formatter style & attributed(s) property. 95 | 96 | - parameter number: The number for flicker animation. 97 | - parameter formatter: The number-formatter style. 98 | - parameter attributes: The attributed number set(a dictionary OR array of dictionaries). 99 | */ 100 | public func fn_setNumber(_ number: NSNumber, formatter: NumberFormatter?, attributes: Any?) { 101 | self.fn_setNumber(number, duration: 1.0, formatter: formatter, attributes: attributes) 102 | } 103 | 104 | /** 105 | Flicker a number with string-format String & attributed(s) property. 106 | 107 | - parameter number: The number for flicker animation. 108 | - parameter format: The string-format String. 109 | - parameter attributes: The attributed string set(a dictionary OR array of dictionaries). You can attributed(s) the number or string-format String. 110 | */ 111 | public func fn_setNumber(_ number: NSNumber, format: String?, attributes: Any?) { 112 | self.fn_setNumber(number, duration: 1.0, format: format, attributes: nil) 113 | } 114 | 115 | /** 116 | Flicker a number in default during time(1.0s) with all effects. 117 | 118 | - parameter number: The number for flicker animation. 119 | - parameter format: The string-format String. 120 | - parameter formatter: The number-formatter style. 121 | - parameter attributes: The attributed string set(a dictionary OR array of dictionaries).You can attributed(s) the number or string-format String. 122 | */ 123 | public func fn_setNumber(_ number: NSNumber, format: String?, formatter: NumberFormatter?, attributes: Any?) { 124 | self.fn_setNumber(number, duration: 1.0, format: format, numberFomatter: formatter ?? fn_defaultNumberFormatter(), attributes: attributes) 125 | } 126 | 127 | /** 128 | Flicker a number in during time with string-format String. 129 | 130 | - parameter nubmer: The number for flicker animation. 131 | - parameter duration: The flicker animation during time. 132 | - parameter format: The number-formatter style. 133 | */ 134 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, format: String?) { 135 | self.fn_setNumber(number, duration: duration, format: format, numberFomatter: nil, attributes: nil) 136 | } 137 | 138 | /** 139 | Flicker a number in during time with string-format String & number-formatter style. 140 | 141 | - parameter nubmer: The number for flicker animation. 142 | - parameter duration: The flicker animation during time. 143 | - parameter format: The string-format String. 144 | - parameter formatter: The number-formatter style. 145 | */ 146 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, format: String?, formatter: NumberFormatter?) { 147 | self.fn_setNumber(number, duration: duration, format: format, numberFomatter: formatter ?? fn_defaultNumberFormatter(), attributes: nil) 148 | } 149 | 150 | /** 151 | Flicker a number in during time with attributed(s) property. 152 | 153 | - parameter number: The number for flicker animation. 154 | - parameter duration: The flicker animation during time. 155 | - parameter attributes: The attributed number set(a dictionary OR array of dictionaries). 156 | */ 157 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, attributes: Any?) { 158 | self.fn_setNumber(number, duration: duration, format: nil, attributes: attributes) 159 | } 160 | 161 | /** 162 | Flicker a number in during time with attributed(s) property of number & number-formatter style. 163 | 164 | - parameter number: The number for flicker animation. 165 | - parameter duration: The flicker animation during time. 166 | - parameter formatter: The number-formatter style. 167 | - parameter attributes: The attributed number set(a dictionary OR array of dictionaries). 168 | */ 169 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, formatter: NumberFormatter?, attributes: Any?) { 170 | self.fn_setNumber(number, duration: duration, format: nil, numberFomatter: formatter ?? fn_defaultNumberFormatter(), attributes: attributes) 171 | } 172 | 173 | /** 174 | Flicker a number in during time with effects except number-formatter style. 175 | 176 | - parameter number: The number for flicker animation. 177 | - parameter duration: The flicker animation during time. 178 | - parameter format: The string-format String. 179 | - parameter attributes: The attributed string set(a dictionary OR array of dictionaries). You can set string-format String OR number attributes both. 180 | */ 181 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, format: String?, attributes: Any?) { 182 | self.fn_setNumber(number, duration: duration, format: format, numberFomatter: nil, attributes: attributes) 183 | } 184 | 185 | /** 186 | Flicker a number in during time with all the effects. You can attributed(s) the number or string-format String. You also can set the number number-fomatter style. 187 | 188 | - parameter number: The number for flicker animation. 189 | - parameter duration: The flicker animation during time. 190 | - parameter format: The string-format String. 191 | - parameter numberFomatter: The number-formatter style. 192 | - parameter attributes: The attributed string set(a dictionary OR array of dictionaries). 193 | */ 194 | public func fn_setNumber(_ number: NSNumber, duration: TimeInterval, format: String?, numberFomatter: NumberFormatter?, attributes: Any?) { 195 | // check the number type 196 | assert(number.isKind(of: NSNumber.self), "Number Type is not matched, exit") 197 | if !number.isKind(of: NSNumber.self) { 198 | text = String(describing: number) 199 | return 200 | } 201 | 202 | //limit duration is positive number and it is larger than 0.3 203 | var durationTime : TimeInterval = Swift.max(fabs(duration), 0.3) 204 | 205 | self.fn_timer?.invalidate() 206 | 207 | //initialize useinfo dict 208 | let userDict: NSMutableDictionary = NSMutableDictionary() 209 | 210 | if format != nil { 211 | userDict.setValue(format, forKey:formatName) 212 | } 213 | 214 | userDict.setValue(number, forKey: resultNumberName) 215 | 216 | //initialize variables 217 | let beginNumber : NSNumber = 0 218 | userDict.setValue(beginNumber, forKey: beginNumberName) 219 | 220 | set_fnNumber(0) 221 | var endNumber = number.int64Value 222 | 223 | //get multiple if number is float & double type 224 | let multiple = self.getTheMultipleFromNumber(number, formatString: format) 225 | 226 | if multiple > 0 { 227 | endNumber = Int64(number.doubleValue * Double(multiple)) 228 | } 229 | //check the number if out of bounds the unsigned int length 230 | if endNumber >= INT64_MAX { 231 | self.text = String(format:"%@", number) 232 | return 233 | } 234 | 235 | userDict.setValue(multiple, forKey: multipleName) 236 | userDict.setValue(NSNumber(value: endNumber), forKey: endNumberName) 237 | 238 | if (Double(endNumber) * frequency)/durationTime < 1.0 { 239 | durationTime = durationTime * 0.3 240 | } 241 | let rangeNumber = (Double(endNumber) * frequency)/durationTime 242 | userDict.setValue(NSNumber(value: rangeNumber), forKey: rangeIntegerName) 243 | 244 | if attributes != nil { 245 | userDict.setValue(attributes, forKey: attributeName) 246 | } 247 | 248 | fn_setFormatter(numberFomatter) 249 | 250 | let timer = Timer.scheduledTimer(timeInterval: frequency, 251 | target: self, 252 | selector: #selector(UILabel.flickerAnimation(_:)), 253 | userInfo: userDict, 254 | repeats: true) 255 | fn_setTimer(timer) 256 | 257 | RunLoop.current.add(timer, forMode: RunLoopMode.commonModes) 258 | } 259 | 260 | //Flicker animation method implementation. 261 | @objc public func flickerAnimation(_ timer: Timer) -> Void { 262 | let userInfo = timer.userInfo as! [String: Any] 263 | let rangeIntegerNumber = userInfo[rangeIntegerName] as! NSNumber 264 | var fnNumber: NSNumber = self.fn_number! 265 | if rangeIntegerNumber.floatValue >= 1.0 { 266 | let resultInteger = fnNumber.int64Value + rangeIntegerNumber.int64Value 267 | fnNumber = NSNumber(value: resultInteger) 268 | } else { 269 | let resultInteger = fnNumber.floatValue + rangeIntegerNumber.floatValue 270 | fnNumber = NSNumber(value: resultInteger) 271 | } 272 | set_fnNumber(fnNumber) 273 | 274 | let multiple = (userInfo[multipleName] as! NSNumber).int32Value 275 | 276 | if multiple > 0 { 277 | self.fn_finalNumberDoubleType(timer, multiple: Int(multiple)) 278 | } else { 279 | let formatter = self.fn_formatter 280 | var formatStr = userInfo[formatName] as? String ?? "" 281 | if formatStr.isEmpty { 282 | if formatter != nil { 283 | formatStr = "%@" 284 | } else { 285 | formatStr = "%.0f" 286 | } 287 | } 288 | self.text = self.fn_finalNumber(fnNumber, format:formatStr, numberFormatter: formatter) 289 | 290 | if let attributes = userInfo[attributeName] { 291 | self.drawAttributes(attributes) 292 | } 293 | 294 | let endNumber = userInfo[endNumberName] as! NSNumber 295 | 296 | if fnNumber.int64Value >= endNumber.int64Value { 297 | let resultNumber = userInfo[resultNumberName] as! NSNumber 298 | self.text = self.fn_finalNumber(resultNumber, format:formatStr, numberFormatter: formatter) 299 | 300 | if let attributes = userInfo[attributeName] { 301 | self.drawAttributes(attributes) 302 | } 303 | self.fn_timer?.invalidate() 304 | } 305 | } 306 | } 307 | 308 | //Get the default number-formatter style. 309 | fileprivate func fn_defaultNumberFormatter() -> NumberFormatter { 310 | let numberFormatter = NumberFormatter() 311 | numberFormatter.numberStyle = .decimal 312 | numberFormatter.formatterBehavior = .default 313 | return numberFormatter 314 | } 315 | 316 | //Show the animation when the number is double type. 317 | fileprivate func fn_finalNumberDoubleType(_ timer: Timer, multiple: Int) { 318 | let userInfo = timer.userInfo as! [String: Any] 319 | let formatter = self.fn_formatter 320 | var formatStr: String = userInfo[formatName] as? String ?? "" 321 | if formatStr.isEmpty { 322 | if formatter != nil { 323 | formatStr = "%@" 324 | } else { 325 | formatStr = String(format: "%%.%df", Int(log10(Float(multiple)))) 326 | } 327 | } 328 | let fnNumber = self.fn_number! 329 | let flickerNumber = fnNumber.doubleValue / Double(multiple) 330 | 331 | self.text = self.fn_finalNumber(NSNumber(value:flickerNumber), format:formatStr, numberFormatter: formatter) 332 | 333 | if let attributes = userInfo[attributeName] { 334 | self.drawAttributes(attributes) 335 | } 336 | 337 | let endNumber = userInfo[endNumberName] as! NSNumber 338 | 339 | if fnNumber.int64Value >= endNumber.int64Value { 340 | let resultNumber = userInfo[resultNumberName] as! NSNumber 341 | 342 | self.text = self.fn_finalNumber(resultNumber, format:formatStr, numberFormatter: formatter) 343 | 344 | if let attributes = userInfo[attributeName] { 345 | self.drawAttributes(attributes) 346 | } 347 | self.fn_timer?.invalidate() 348 | } 349 | } 350 | 351 | //Get the string from number with number-formatter style. 352 | fileprivate func fn_stringFromNumber(_ number: NSNumber, numberFormatter: NumberFormatter) -> String? { 353 | return numberFormatter.string(from: number) 354 | } 355 | 356 | //Get the result string to do animation. 357 | fileprivate func fn_finalNumber(_ number : NSNumber, format: String, numberFormatter: NumberFormatter?) -> String? { 358 | var finalString = String() 359 | if let numberFormatter = numberFormatter { 360 | finalString = String(format: format, self.fn_stringFromNumber(number, numberFormatter: numberFormatter)!) 361 | } else { 362 | assert(format.range(of: "%@") == nil, "string format type is not matched, please check your format type.") 363 | if format.range(of: "%d") != nil { 364 | finalString = String(format: format, number.int64Value) 365 | } else { 366 | finalString = String(format: format, number.doubleValue) 367 | } 368 | } 369 | return finalString 370 | } 371 | 372 | //Add the attributes into the mutable attributed string. 373 | fileprivate func drawAttributes(_ attributes: Any) -> Void { 374 | if let attributes = attributes as? [String: Any] { 375 | let range = (attributes[fnRangeName] as! NSValue).rangeValue 376 | let attri = attributes[fnAttributeName] as! [NSAttributedStringKey : Any] 377 | self.addAttributes(attri, range : range) 378 | } else if let attributes = attributes as? [[String: Any]] { 379 | for attribute in attributes { 380 | self.drawAttributes(attribute) 381 | } 382 | } 383 | } 384 | 385 | fileprivate func addAttributes(_ attributes: [NSAttributedStringKey : Any], range: NSRange) -> Void { 386 | let attributedStr = NSMutableAttributedString(attributedString : self.attributedText!) 387 | if range.location + range.length < attributedStr.length { 388 | attributedStr.addAttributes(attributes, range: range) 389 | } 390 | self.attributedText = attributedStr 391 | } 392 | 393 | /** 394 | Get the multiple form the number. 395 | 396 | - parameter number: The origin number. 397 | - parameter formatString: The string-format String. 398 | 399 | - returns: The multiple of the number. 400 | */ 401 | fileprivate func getTheMultipleFromNumber(_ number: NSNumber, formatString: String?) -> Int { 402 | var newNumber = number 403 | let point:Character = "." 404 | if let formatString = formatString, formatString.range(of: "%@") == nil { 405 | 406 | if formatString.range(of: "%d") != nil { 407 | return 0 408 | } 409 | 410 | let fStr = self.regexNumberFormat(formatString) 411 | let formatNumberStr = String(format: fStr, number.floatValue) 412 | if let idx = formatNumberStr.index(of: point) 413 | { 414 | let subStrCount = formatNumberStr.distance(from: idx, to: formatNumberStr.endIndex) 415 | let length = Swift.min(subStrCount, 6) 416 | let padding = log10f(Float(length)) 417 | newNumber = NSNumber(value:(formatNumberStr as NSString).floatValue + padding) 418 | } 419 | } 420 | 421 | let resultStr = String(format: "%@", newNumber) 422 | if let idx = resultStr.index(of: point) 423 | { 424 | let subStrCount = resultStr.distance(from: idx, to: resultStr.endIndex) 425 | // Max Multiple is 6 426 | let length = Swift.min(subStrCount, 6) 427 | return Int(powf(10, Float(length))) 428 | } 429 | return 0 430 | } 431 | 432 | /** 433 | Get new the string-format String. 434 | 435 | - parameter format: The origin string-format String. 436 | 437 | - returns: The new string-format String. 438 | */ 439 | fileprivate func regexNumberFormat(_ format: String) -> String { 440 | let patternStr = "^%((\\d+.\\d+)|(\\d+).|(.\\d+))f$" 441 | do { 442 | let regex : NSRegularExpression = try NSRegularExpression(pattern: patternStr, options: .caseInsensitive) 443 | let fRange = NSRange(location: 0, length: format.count) 444 | if let match = regex.firstMatch(in: format, options: .reportProgress, range: fRange) { 445 | let result = (format as NSString).substring(with: match.range) 446 | return result 447 | } 448 | } catch { 449 | print("Exception") 450 | } 451 | return "%f" 452 | } 453 | } 454 | 455 | private var flickerNumberKey : Void? 456 | private var flickerNumberFormatterKey : Void? 457 | private var flickerTimerKey : Void? 458 | 459 | extension UILabel { 460 | /// The intermediate number, it's private variable. Extend property use the runtime feature. 461 | public var fn_number: NSNumber? { 462 | get { 463 | return objc_getAssociatedObject(self, &flickerNumberKey) as? NSNumber 464 | } 465 | } 466 | 467 | fileprivate func set_fnNumber(_ number: NSNumber) { 468 | objc_setAssociatedObject(self, &flickerNumberKey, number, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 469 | } 470 | 471 | /// The number-formatter style, it's private varibale. Extend property use the runtime feature. 472 | public var fn_formatter: NumberFormatter? { 473 | get { 474 | return objc_getAssociatedObject(self, &flickerNumberFormatterKey) as? NumberFormatter 475 | } 476 | } 477 | 478 | fileprivate func fn_setFormatter(_ formatter: NumberFormatter?) { 479 | objc_setAssociatedObject(self, &flickerNumberFormatterKey, formatter, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 480 | } 481 | 482 | /// The flicker animation time count Timer. 483 | public var fn_timer: Timer? { 484 | get { 485 | return objc_getAssociatedObject(self, &flickerTimerKey) as? Timer 486 | } 487 | } 488 | 489 | fileprivate func fn_setTimer(_ timer: Timer) { 490 | objc_setAssociatedObject(self, &flickerTimerKey, timer, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 491 | } 492 | } 493 | 494 | public let fnAttributeName = "attributeKey" 495 | public let fnRangeName = "rangeKey" 496 | 497 | extension NSDictionary { 498 | /** 499 | Create an attribute texts dictionary, like the NSAttributedString. 500 | 501 | - parameter attribute: The attributed text of the dictionary. 502 | - parameter range: The range of the attributed text. 503 | 504 | - returns: Dictionary of attributed text. 505 | */ 506 | public static func fn_dictionary(_ attribute: [NSAttributedStringKey : Any], range: NSRange) -> [String : Any] { 507 | return [fnAttributeName: attribute, fnRangeName: NSValue(range: range)] 508 | } 509 | } 510 | 511 | 512 | -------------------------------------------------------------------------------- /Swift/FlickerNumber-Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0D6613FF1BDA6C7C00270ADA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D6613FE1BDA6C7C00270ADA /* AppDelegate.swift */; }; 11 | 0D6614011BDA6C7C00270ADA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D6614001BDA6C7C00270ADA /* ViewController.swift */; }; 12 | 0D6614041BDA6C7C00270ADA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D6614021BDA6C7C00270ADA /* Main.storyboard */; }; 13 | 0D6614061BDA6C7C00270ADA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0D6614051BDA6C7C00270ADA /* Assets.xcassets */; }; 14 | 0D6614091BDA6C7C00270ADA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D6614071BDA6C7C00270ADA /* LaunchScreen.storyboard */; }; 15 | 0D66142D1BDA6DC600270ADA /* UILabel+FlickerNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D66142C1BDA6DC600270ADA /* UILabel+FlickerNumber.swift */; }; 16 | 0DB56E6E1F1D9E5500330E4B /* FlickerNumber_SwiftUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DB56E6D1F1D9E5500330E4B /* FlickerNumber_SwiftUITests.m */; }; 17 | 0DB56E7C1F1D9E5F00330E4B /* FlickerNumber_SwiftTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DB56E7B1F1D9E5F00330E4B /* FlickerNumber_SwiftTests.m */; }; 18 | 0DCFC1111BF0ECDC00EE1FA3 /* ListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DCFC1101BF0ECDC00EE1FA3 /* ListViewController.swift */; }; 19 | 0DF3BFBA1BF56EA6002857E0 /* FlickerNumber-Swift.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 0DF3BFB91BF56EA6002857E0 /* FlickerNumber-Swift.podspec */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 0DB56E701F1D9E5500330E4B /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 0D6613F31BDA6C7B00270ADA /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 0D6613FA1BDA6C7C00270ADA; 28 | remoteInfo = "FlickerNumber-Swift"; 29 | }; 30 | 0DB56E7E1F1D9E5F00330E4B /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 0D6613F31BDA6C7B00270ADA /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 0D6613FA1BDA6C7C00270ADA; 35 | remoteInfo = "FlickerNumber-Swift"; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 0D6613FB1BDA6C7C00270ADA /* FlickerNumber-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FlickerNumber-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 0D6613FE1BDA6C7C00270ADA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | 0D6614001BDA6C7C00270ADA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 43 | 0D6614031BDA6C7C00270ADA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 0D6614051BDA6C7C00270ADA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 0D6614081BDA6C7C00270ADA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 0D66140A1BDA6C7C00270ADA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 0D66142C1BDA6DC600270ADA /* UILabel+FlickerNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+FlickerNumber.swift"; sourceTree = ""; }; 48 | 0DB56E6B1F1D9E5500330E4B /* FlickerNumber-SwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FlickerNumber-SwiftUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 0DB56E6D1F1D9E5500330E4B /* FlickerNumber_SwiftUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlickerNumber_SwiftUITests.m; sourceTree = ""; }; 50 | 0DB56E6F1F1D9E5500330E4B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 0DB56E791F1D9E5F00330E4B /* FlickerNumber-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FlickerNumber-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 0DB56E7B1F1D9E5F00330E4B /* FlickerNumber_SwiftTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlickerNumber_SwiftTests.m; sourceTree = ""; }; 53 | 0DB56E7D1F1D9E5F00330E4B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 0DCFC1101BF0ECDC00EE1FA3 /* ListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListViewController.swift; sourceTree = ""; }; 55 | 0DF3BFB91BF56EA6002857E0 /* FlickerNumber-Swift.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "FlickerNumber-Swift.podspec"; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 0D6613F81BDA6C7C00270ADA /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 0DB56E681F1D9E5500330E4B /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 0DB56E761F1D9E5F00330E4B /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 0D6613F21BDA6C7B00270ADA = { 84 | isa = PBXGroup; 85 | children = ( 86 | 0DF3BFB91BF56EA6002857E0 /* FlickerNumber-Swift.podspec */, 87 | 0D6613FD1BDA6C7C00270ADA /* FlickerNumber-Swift */, 88 | 0DB56E6C1F1D9E5500330E4B /* FlickerNumber-SwiftUITests */, 89 | 0DB56E7A1F1D9E5F00330E4B /* FlickerNumber-SwiftTests */, 90 | 0D6613FC1BDA6C7C00270ADA /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 0D6613FC1BDA6C7C00270ADA /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 0D6613FB1BDA6C7C00270ADA /* FlickerNumber-Swift.app */, 98 | 0DB56E6B1F1D9E5500330E4B /* FlickerNumber-SwiftUITests.xctest */, 99 | 0DB56E791F1D9E5F00330E4B /* FlickerNumber-SwiftTests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 0D6613FD1BDA6C7C00270ADA /* FlickerNumber-Swift */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 0D6613FE1BDA6C7C00270ADA /* AppDelegate.swift */, 108 | 0DCFC1101BF0ECDC00EE1FA3 /* ListViewController.swift */, 109 | 0D6614001BDA6C7C00270ADA /* ViewController.swift */, 110 | 0D6614021BDA6C7C00270ADA /* Main.storyboard */, 111 | 0D6614051BDA6C7C00270ADA /* Assets.xcassets */, 112 | 0D6614071BDA6C7C00270ADA /* LaunchScreen.storyboard */, 113 | 0D66140A1BDA6C7C00270ADA /* Info.plist */, 114 | 0D66142C1BDA6DC600270ADA /* UILabel+FlickerNumber.swift */, 115 | ); 116 | path = "FlickerNumber-Swift"; 117 | sourceTree = ""; 118 | }; 119 | 0DB56E6C1F1D9E5500330E4B /* FlickerNumber-SwiftUITests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 0DB56E6D1F1D9E5500330E4B /* FlickerNumber_SwiftUITests.m */, 123 | 0DB56E6F1F1D9E5500330E4B /* Info.plist */, 124 | ); 125 | path = "FlickerNumber-SwiftUITests"; 126 | sourceTree = ""; 127 | }; 128 | 0DB56E7A1F1D9E5F00330E4B /* FlickerNumber-SwiftTests */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 0DB56E7B1F1D9E5F00330E4B /* FlickerNumber_SwiftTests.m */, 132 | 0DB56E7D1F1D9E5F00330E4B /* Info.plist */, 133 | ); 134 | path = "FlickerNumber-SwiftTests"; 135 | sourceTree = ""; 136 | }; 137 | /* End PBXGroup section */ 138 | 139 | /* Begin PBXNativeTarget section */ 140 | 0D6613FA1BDA6C7C00270ADA /* FlickerNumber-Swift */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = 0D6614231BDA6C7C00270ADA /* Build configuration list for PBXNativeTarget "FlickerNumber-Swift" */; 143 | buildPhases = ( 144 | 0D6613F71BDA6C7C00270ADA /* Sources */, 145 | 0D6613F81BDA6C7C00270ADA /* Frameworks */, 146 | 0D6613F91BDA6C7C00270ADA /* Resources */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | ); 152 | name = "FlickerNumber-Swift"; 153 | productName = FlickerNumber; 154 | productReference = 0D6613FB1BDA6C7C00270ADA /* FlickerNumber-Swift.app */; 155 | productType = "com.apple.product-type.application"; 156 | }; 157 | 0DB56E6A1F1D9E5500330E4B /* FlickerNumber-SwiftUITests */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 0DB56E741F1D9E5500330E4B /* Build configuration list for PBXNativeTarget "FlickerNumber-SwiftUITests" */; 160 | buildPhases = ( 161 | 0DB56E671F1D9E5500330E4B /* Sources */, 162 | 0DB56E681F1D9E5500330E4B /* Frameworks */, 163 | 0DB56E691F1D9E5500330E4B /* Resources */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | 0DB56E711F1D9E5500330E4B /* PBXTargetDependency */, 169 | ); 170 | name = "FlickerNumber-SwiftUITests"; 171 | productName = "FlickerNumber-SwiftUITests"; 172 | productReference = 0DB56E6B1F1D9E5500330E4B /* FlickerNumber-SwiftUITests.xctest */; 173 | productType = "com.apple.product-type.bundle.ui-testing"; 174 | }; 175 | 0DB56E781F1D9E5F00330E4B /* FlickerNumber-SwiftTests */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 0DB56E801F1D9E5F00330E4B /* Build configuration list for PBXNativeTarget "FlickerNumber-SwiftTests" */; 178 | buildPhases = ( 179 | 0DB56E751F1D9E5F00330E4B /* Sources */, 180 | 0DB56E761F1D9E5F00330E4B /* Frameworks */, 181 | 0DB56E771F1D9E5F00330E4B /* Resources */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | 0DB56E7F1F1D9E5F00330E4B /* PBXTargetDependency */, 187 | ); 188 | name = "FlickerNumber-SwiftTests"; 189 | productName = "FlickerNumber-SwiftTests"; 190 | productReference = 0DB56E791F1D9E5F00330E4B /* FlickerNumber-SwiftTests.xctest */; 191 | productType = "com.apple.product-type.bundle.unit-test"; 192 | }; 193 | /* End PBXNativeTarget section */ 194 | 195 | /* Begin PBXProject section */ 196 | 0D6613F31BDA6C7B00270ADA /* Project object */ = { 197 | isa = PBXProject; 198 | attributes = { 199 | LastSwiftUpdateCheck = 0710; 200 | LastUpgradeCheck = 0710; 201 | ORGANIZATIONNAME = ddkit; 202 | TargetAttributes = { 203 | 0D6613FA1BDA6C7C00270ADA = { 204 | CreatedOnToolsVersion = 7.1; 205 | DevelopmentTeam = F76XM9QFY9; 206 | LastSwiftMigration = 0830; 207 | }; 208 | 0DB56E6A1F1D9E5500330E4B = { 209 | CreatedOnToolsVersion = 8.3.3; 210 | DevelopmentTeam = F76XM9QFY9; 211 | ProvisioningStyle = Automatic; 212 | TestTargetID = 0D6613FA1BDA6C7C00270ADA; 213 | }; 214 | 0DB56E781F1D9E5F00330E4B = { 215 | CreatedOnToolsVersion = 8.3.3; 216 | DevelopmentTeam = F76XM9QFY9; 217 | ProvisioningStyle = Automatic; 218 | TestTargetID = 0D6613FA1BDA6C7C00270ADA; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 0D6613F61BDA6C7B00270ADA /* Build configuration list for PBXProject "FlickerNumber-Swift" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 0D6613F21BDA6C7B00270ADA; 231 | productRefGroup = 0D6613FC1BDA6C7C00270ADA /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 0D6613FA1BDA6C7C00270ADA /* FlickerNumber-Swift */, 236 | 0DB56E6A1F1D9E5500330E4B /* FlickerNumber-SwiftUITests */, 237 | 0DB56E781F1D9E5F00330E4B /* FlickerNumber-SwiftTests */, 238 | ); 239 | }; 240 | /* End PBXProject section */ 241 | 242 | /* Begin PBXResourcesBuildPhase section */ 243 | 0D6613F91BDA6C7C00270ADA /* Resources */ = { 244 | isa = PBXResourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 0D6614091BDA6C7C00270ADA /* LaunchScreen.storyboard in Resources */, 248 | 0D6614061BDA6C7C00270ADA /* Assets.xcassets in Resources */, 249 | 0DF3BFBA1BF56EA6002857E0 /* FlickerNumber-Swift.podspec in Resources */, 250 | 0D6614041BDA6C7C00270ADA /* Main.storyboard in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | 0DB56E691F1D9E5500330E4B /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | 0DB56E771F1D9E5F00330E4B /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | /* End PBXResourcesBuildPhase section */ 269 | 270 | /* Begin PBXSourcesBuildPhase section */ 271 | 0D6613F71BDA6C7C00270ADA /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 0D6614011BDA6C7C00270ADA /* ViewController.swift in Sources */, 276 | 0D6613FF1BDA6C7C00270ADA /* AppDelegate.swift in Sources */, 277 | 0DCFC1111BF0ECDC00EE1FA3 /* ListViewController.swift in Sources */, 278 | 0D66142D1BDA6DC600270ADA /* UILabel+FlickerNumber.swift in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | 0DB56E671F1D9E5500330E4B /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 0DB56E6E1F1D9E5500330E4B /* FlickerNumber_SwiftUITests.m in Sources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 0DB56E751F1D9E5F00330E4B /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 0DB56E7C1F1D9E5F00330E4B /* FlickerNumber_SwiftTests.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | /* End PBXSourcesBuildPhase section */ 299 | 300 | /* Begin PBXTargetDependency section */ 301 | 0DB56E711F1D9E5500330E4B /* PBXTargetDependency */ = { 302 | isa = PBXTargetDependency; 303 | target = 0D6613FA1BDA6C7C00270ADA /* FlickerNumber-Swift */; 304 | targetProxy = 0DB56E701F1D9E5500330E4B /* PBXContainerItemProxy */; 305 | }; 306 | 0DB56E7F1F1D9E5F00330E4B /* PBXTargetDependency */ = { 307 | isa = PBXTargetDependency; 308 | target = 0D6613FA1BDA6C7C00270ADA /* FlickerNumber-Swift */; 309 | targetProxy = 0DB56E7E1F1D9E5F00330E4B /* PBXContainerItemProxy */; 310 | }; 311 | /* End PBXTargetDependency section */ 312 | 313 | /* Begin PBXVariantGroup section */ 314 | 0D6614021BDA6C7C00270ADA /* Main.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 0D6614031BDA6C7C00270ADA /* Base */, 318 | ); 319 | name = Main.storyboard; 320 | sourceTree = ""; 321 | }; 322 | 0D6614071BDA6C7C00270ADA /* LaunchScreen.storyboard */ = { 323 | isa = PBXVariantGroup; 324 | children = ( 325 | 0D6614081BDA6C7C00270ADA /* Base */, 326 | ); 327 | name = LaunchScreen.storyboard; 328 | sourceTree = ""; 329 | }; 330 | /* End PBXVariantGroup section */ 331 | 332 | /* Begin XCBuildConfiguration section */ 333 | 0D6614211BDA6C7C00270ADA /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 384 | }; 385 | name = Debug; 386 | }; 387 | 0D6614221BDA6C7C00270ADA /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 396 | CLANG_WARN_BOOL_CONVERSION = YES; 397 | CLANG_WARN_COMMA = YES; 398 | CLANG_WARN_CONSTANT_CONVERSION = YES; 399 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 410 | CLANG_WARN_STRICT_PROTOTYPES = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_UNREACHABLE_CODE = YES; 413 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 417 | ENABLE_NS_ASSERTIONS = NO; 418 | ENABLE_STRICT_OBJC_MSGSEND = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu99; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 428 | MTL_ENABLE_DEBUG_INFO = NO; 429 | SDKROOT = iphoneos; 430 | SWIFT_COMPILATION_MODE = wholemodule; 431 | VALIDATE_PRODUCT = YES; 432 | }; 433 | name = Release; 434 | }; 435 | 0D6614241BDA6C7C00270ADA /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | DEVELOPMENT_TEAM = F76XM9QFY9; 440 | INFOPLIST_FILE = "$(SRCROOT)/FlickerNumber-Swift/Info.plist"; 441 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = com.ddkit.FlickerNumber; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | SWIFT_VERSION = 4.0; 446 | }; 447 | name = Debug; 448 | }; 449 | 0D6614251BDA6C7C00270ADA /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 453 | DEVELOPMENT_TEAM = F76XM9QFY9; 454 | INFOPLIST_FILE = "$(SRCROOT)/FlickerNumber-Swift/Info.plist"; 455 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 457 | PRODUCT_BUNDLE_IDENTIFIER = com.ddkit.FlickerNumber; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_VERSION = 4.0; 460 | }; 461 | name = Release; 462 | }; 463 | 0DB56E721F1D9E5500330E4B /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 467 | CLANG_ANALYZER_NONNULL = YES; 468 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 469 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 470 | CLANG_WARN_INFINITE_RECURSION = YES; 471 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 472 | DEVELOPMENT_TEAM = F76XM9QFY9; 473 | INFOPLIST_FILE = "FlickerNumber-SwiftUITests/Info.plist"; 474 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 476 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.FlickerNumber-SwiftUITests"; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TEST_TARGET_NAME = "FlickerNumber-Swift"; 479 | }; 480 | name = Debug; 481 | }; 482 | 0DB56E731F1D9E5500330E4B /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 486 | CLANG_ANALYZER_NONNULL = YES; 487 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 488 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 489 | CLANG_WARN_INFINITE_RECURSION = YES; 490 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 491 | DEVELOPMENT_TEAM = F76XM9QFY9; 492 | INFOPLIST_FILE = "FlickerNumber-SwiftUITests/Info.plist"; 493 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 495 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.FlickerNumber-SwiftUITests"; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | TEST_TARGET_NAME = "FlickerNumber-Swift"; 498 | }; 499 | name = Release; 500 | }; 501 | 0DB56E811F1D9E5F00330E4B /* Debug */ = { 502 | isa = XCBuildConfiguration; 503 | buildSettings = { 504 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 505 | BUNDLE_LOADER = "$(TEST_HOST)"; 506 | CLANG_ANALYZER_NONNULL = YES; 507 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 508 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 509 | CLANG_WARN_INFINITE_RECURSION = YES; 510 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 511 | DEVELOPMENT_TEAM = F76XM9QFY9; 512 | INFOPLIST_FILE = "FlickerNumber-SwiftTests/Info.plist"; 513 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 515 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.FlickerNumber-SwiftTests"; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FlickerNumber-Swift.app/FlickerNumber-Swift"; 518 | }; 519 | name = Debug; 520 | }; 521 | 0DB56E821F1D9E5F00330E4B /* Release */ = { 522 | isa = XCBuildConfiguration; 523 | buildSettings = { 524 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 525 | BUNDLE_LOADER = "$(TEST_HOST)"; 526 | CLANG_ANALYZER_NONNULL = YES; 527 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 528 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 529 | CLANG_WARN_INFINITE_RECURSION = YES; 530 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 531 | DEVELOPMENT_TEAM = F76XM9QFY9; 532 | INFOPLIST_FILE = "FlickerNumber-SwiftTests/Info.plist"; 533 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 534 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 535 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.FlickerNumber-SwiftTests"; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FlickerNumber-Swift.app/FlickerNumber-Swift"; 538 | }; 539 | name = Release; 540 | }; 541 | /* End XCBuildConfiguration section */ 542 | 543 | /* Begin XCConfigurationList section */ 544 | 0D6613F61BDA6C7B00270ADA /* Build configuration list for PBXProject "FlickerNumber-Swift" */ = { 545 | isa = XCConfigurationList; 546 | buildConfigurations = ( 547 | 0D6614211BDA6C7C00270ADA /* Debug */, 548 | 0D6614221BDA6C7C00270ADA /* Release */, 549 | ); 550 | defaultConfigurationIsVisible = 0; 551 | defaultConfigurationName = Release; 552 | }; 553 | 0D6614231BDA6C7C00270ADA /* Build configuration list for PBXNativeTarget "FlickerNumber-Swift" */ = { 554 | isa = XCConfigurationList; 555 | buildConfigurations = ( 556 | 0D6614241BDA6C7C00270ADA /* Debug */, 557 | 0D6614251BDA6C7C00270ADA /* Release */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | defaultConfigurationName = Release; 561 | }; 562 | 0DB56E741F1D9E5500330E4B /* Build configuration list for PBXNativeTarget "FlickerNumber-SwiftUITests" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 0DB56E721F1D9E5500330E4B /* Debug */, 566 | 0DB56E731F1D9E5500330E4B /* Release */, 567 | ); 568 | defaultConfigurationIsVisible = 0; 569 | defaultConfigurationName = Release; 570 | }; 571 | 0DB56E801F1D9E5F00330E4B /* Build configuration list for PBXNativeTarget "FlickerNumber-SwiftTests" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 0DB56E811F1D9E5F00330E4B /* Debug */, 575 | 0DB56E821F1D9E5F00330E4B /* Release */, 576 | ); 577 | defaultConfigurationIsVisible = 0; 578 | defaultConfigurationName = Release; 579 | }; 580 | /* End XCConfigurationList section */ 581 | }; 582 | rootObject = 0D6613F31BDA6C7B00270ADA /* Project object */; 583 | } 584 | --------------------------------------------------------------------------------