├── Demo
├── CountdownTimerDemo
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── ViewController.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── SceneDelegate.swift
│ └── CountdownTimer.swift
└── CountdownTimerDemo.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── project.pbxproj
├── README.md
├── LICENSE
├── .gitignore
└── CountdownTimer.swift
/Demo/CountdownTimerDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CountdownTimer
2 |
3 | ```
4 | // Custom timer key
5 | enum Countdowns: String, Countdownable {
6 | case test1, test2
7 |
8 | var countdownKey: String {
9 | return rawValue
10 | }
11 | }
12 | ```
13 |
14 | ```
15 | // start a timer
16 | CountdownTimer.start(key: Countdowns.test1, count: 60) { [weak self] (count, finished) in
17 | self?.countdownLabel1.text = "\(count)"
18 | }
19 | ```
20 |
21 | ```
22 | // subscribe a timer
23 | CountdownTimer.subscribe(key: Countdowns.test1, for: "scenario1") { count, finished in
24 | print("==> \(count) : \(finished)")
25 | }
26 | ```
27 |
28 | ```
29 | // unsubscribe a timer
30 | CountdownTimer.unsubscribe(scenario: "scenario1")
31 | ```
32 |
33 | ```
34 | // cancel a timer
35 | CountdownTimer.cancel(key: Countdowns.test2)
36 | ```
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 wuhao
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // CountdownTimerDemo
4 | //
5 | // Created by wuhao on 2019/10/27.
6 | // Copyright © 2019 wuhao. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 |
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | // MARK: UISceneSession Lifecycle
22 |
23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
24 | // Called when a new scene session is being created.
25 | // Use this method to select a configuration to create the new scene with.
26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
27 | }
28 |
29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {
30 | // Called when the user discards a scene session.
31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
33 | }
34 |
35 |
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // CountdownTimerDemo
4 | //
5 | // Created by wuhao on 2019/10/27.
6 | // Copyright © 2019 wuhao. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | enum Countdowns: String, Countdownable {
12 | case test1, test2
13 |
14 | var countdownKey: String {
15 | return rawValue
16 | }
17 | }
18 |
19 | class ViewController: UIViewController {
20 |
21 | @IBOutlet private weak var countdownLabel1: UILabel!
22 | @IBOutlet private weak var countdownLabel2: UILabel!
23 |
24 | override func viewDidLoad() {
25 | super.viewDidLoad()
26 | CountdownTimer.subscribe(key: Countdowns.test1, for: "scenario1") { count, finished in
27 | print("🐯==> \(count) : \(finished)")
28 | }
29 | }
30 |
31 | @IBAction private func didClickStartTimer1Button(_ sender: Any) {
32 | CountdownTimer.start(key: Countdowns.test1, count: 60) { [weak self] (count, finished) in
33 | self?.countdownLabel1.text = "\(count)"
34 | }
35 | }
36 |
37 | @IBAction private func didClickStartTimer2Button(_ sender: Any) {
38 | CountdownTimer.start(key: Countdowns.test2, count: 30) { [weak self] (count, finished) in
39 | self?.countdownLabel2.text = "\(count)"
40 | }
41 | CountdownTimer.subscribe(key: Countdowns.test1, for: "scenario2") { count, finished in
42 | print("🐯--> \(count) : \(finished)")
43 | }
44 | }
45 |
46 | override func touchesBegan(_ touches: Set, with event: UIEvent?) {
47 | CountdownTimer.cancel(key: Countdowns.test2)
48 | CountdownTimer.unsubscribe(scenario: "scenario2")
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | ## Playgrounds
32 | timeline.xctimeline
33 | playground.xcworkspace
34 |
35 | # Swift Package Manager
36 | #
37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
38 | # Packages/
39 | # Package.pins
40 | # Package.resolved
41 | .build/
42 |
43 | # CocoaPods
44 | #
45 | # We recommend against adding the Pods directory to your .gitignore. However
46 | # you should judge for yourself, the pros and cons are mentioned at:
47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48 | #
49 | # Pods/
50 |
51 | # Carthage
52 | #
53 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
54 | # Carthage/Checkouts
55 |
56 | Carthage/Build
57 |
58 | # fastlane
59 | #
60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61 | # screenshots whenever they are needed.
62 | # For more information about the recommended setup visit:
63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
64 |
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots/**/*.png
68 | fastlane/test_output
69 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/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 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 | UISceneConfigurations
28 |
29 | UIWindowSceneSessionRoleApplication
30 |
31 |
32 | UISceneConfigurationName
33 | Default Configuration
34 | UISceneDelegateClassName
35 | $(PRODUCT_MODULE_NAME).SceneDelegate
36 | UISceneStoryboardFile
37 | Main
38 |
39 |
40 |
41 |
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIMainStoryboardFile
45 | Main
46 | UIRequiredDeviceCapabilities
47 |
48 | armv7
49 |
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationLandscapeLeft
54 | UIInterfaceOrientationLandscapeRight
55 |
56 | UISupportedInterfaceOrientations~ipad
57 |
58 | UIInterfaceOrientationPortrait
59 | UIInterfaceOrientationPortraitUpsideDown
60 | UIInterfaceOrientationLandscapeLeft
61 | UIInterfaceOrientationLandscapeRight
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/SceneDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SceneDelegate.swift
3 | // CountdownTimerDemo
4 | //
5 | // Created by wuhao on 2019/10/27.
6 | // Copyright © 2019 wuhao. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate {
12 |
13 | var window: UIWindow?
14 |
15 |
16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
20 | guard let _ = (scene as? UIWindowScene) else { return }
21 | }
22 |
23 | func sceneDidDisconnect(_ scene: UIScene) {
24 | // Called as the scene is being released by the system.
25 | // This occurs shortly after the scene enters the background, or when its session is discarded.
26 | // Release any resources associated with this scene that can be re-created the next time the scene connects.
27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
28 | }
29 |
30 | func sceneDidBecomeActive(_ scene: UIScene) {
31 | // Called when the scene has moved from an inactive state to an active state.
32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
33 | }
34 |
35 | func sceneWillResignActive(_ scene: UIScene) {
36 | // Called when the scene will move from an active state to an inactive state.
37 | // This may occur due to temporary interruptions (ex. an incoming phone call).
38 | }
39 |
40 | func sceneWillEnterForeground(_ scene: UIScene) {
41 | // Called as the scene transitions from the background to the foreground.
42 | // Use this method to undo the changes made on entering the background.
43 | }
44 |
45 | func sceneDidEnterBackground(_ scene: UIScene) {
46 | // Called as the scene transitions from the foreground to the background.
47 | // Use this method to save data, release shared resources, and store enough scene-specific state information
48 | // to restore the scene back to its current state.
49 | }
50 |
51 |
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/CountdownTimer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CountdownTimer.swift
3 | //
4 | // Created by wuhao on 2019/10/27.
5 | // Copyright © 2019 wuhao. All rights reserved.
6 | // https://github.com/remember17/CountdownTimer
7 |
8 | import UIKit
9 |
10 | public protocol Countdownable {
11 | var countdownKey: String { get }
12 | }
13 |
14 | public class CountdownTimer {
15 | private struct Countdown {
16 | var key: Countdownable
17 | var endTimeInterval: TimeInterval
18 | var timer: DispatchSourceTimer?
19 | var callBack: CountdownCallback?
20 | var currentCount = 0
21 | }
22 | public typealias CountdownCallback = (_ count: Int, _ finished: Bool) -> Void
23 | private var countdowns = [String: Countdown]()
24 | private var scenarioCallbacks = [String: CountdownCallback]()
25 | private var subscribedScenarioKeys = [String: String]()
26 | static private let shared = CountdownTimer()
27 | private let lock = NSLock()
28 |
29 | public static func start(key: Countdownable,
30 | count: Int,
31 | callBack: @escaping CountdownCallback) {
32 | let endTimeInterval = TimeInterval(count) + Date().timeIntervalSince1970
33 | let timer = CountdownTimer.shared.createTimer(key: key, endTimeInterval: endTimeInterval)
34 | CountdownTimer.shared.addCountdown(key: key, countdown: Countdown(key: key,
35 | endTimeInterval: endTimeInterval,
36 | timer: timer,
37 | callBack: callBack))
38 | CountdownTimer.shared.resume(key: key)
39 | }
40 |
41 | public static func cancel(key: Countdownable) {
42 | CountdownTimer.shared.remove(key: key)
43 | }
44 |
45 | public static func subscribe(key: Countdownable,
46 | for scenario: String,
47 | callBack: @escaping CountdownCallback) {
48 | CountdownTimer.shared.addScenarioCallback(key: key, for: scenario, callBack: callBack)
49 | }
50 |
51 | public static func unsubscribe(scenario: String) {
52 | CountdownTimer.shared.removeScenarioCallback(scenario: scenario)
53 | }
54 | }
55 |
56 | extension CountdownTimer {
57 | private func createTimer(key: Countdownable, endTimeInterval: TimeInterval) -> DispatchSourceTimer? {
58 | let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.global())
59 | timer.schedule(wallDeadline: .now(), repeating: 1)
60 | timer.setEventHandler(handler: {
61 | let currentTimeInterval = Date().timeIntervalSince1970
62 | var countdown = Int(round(endTimeInterval - currentTimeInterval))
63 | countdown -= 1
64 | let result = max(countdown, 0)
65 | DispatchQueue.main.async {
66 | self.handleCallback(key, result, result == 0)
67 | }
68 | })
69 | return timer
70 | }
71 |
72 | private func handleCallback(_ key: Countdownable, _ count: Int, _ finished: Bool) {
73 | guard var countdown = getCountdown(key: key),
74 | let callback = countdown.callBack else {
75 | remove(key: key)
76 | return
77 | }
78 | countdown.currentCount = count
79 | callback(count, finished)
80 | for (scenario, countdownKey) in subscribedScenarioKeys {
81 | if countdownKey == key.countdownKey,
82 | let scenarioCallback = getSubscribedInfo(scenario: scenario).scenarioCallback {
83 | scenarioCallback(count, finished)
84 | }
85 | }
86 | guard finished else { return }
87 | remove(key: key)
88 | }
89 | }
90 |
91 | extension CountdownTimer {
92 | private func addCountdown(key: Countdownable,
93 | countdown: Countdown) {
94 | lock.lock()
95 | countdowns[key.countdownKey] = countdown
96 | lock.unlock()
97 | }
98 |
99 | private func getCountdown(key: Countdownable) -> Countdown? {
100 | lock.lock()
101 | let countdown = countdowns[key.countdownKey]
102 | lock.unlock()
103 | return countdown
104 | }
105 |
106 | private func addScenarioCallback(key: Countdownable,
107 | for scenario: String,
108 | callBack: @escaping CountdownCallback) {
109 | lock.lock()
110 | scenarioCallbacks[scenario] = callBack
111 | subscribedScenarioKeys[scenario] = key.countdownKey
112 | lock.unlock()
113 | }
114 |
115 | private func removeScenarioCallback(scenario: String) {
116 | lock.lock()
117 | scenarioCallbacks.removeValue(forKey: scenario)
118 | subscribedScenarioKeys.removeValue(forKey: scenario)
119 | lock.unlock()
120 | }
121 |
122 | private func getSubscribedInfo(scenario: String) -> (countdownKey: String?,
123 | scenarioCallback: CountdownCallback?) {
124 | lock.lock()
125 | let countdownKey = subscribedScenarioKeys[scenario]
126 | let callback = scenarioCallbacks[scenario]
127 | lock.unlock()
128 | return (countdownKey, callback)
129 | }
130 |
131 | private func remove(key: Countdownable) {
132 | lock.lock()
133 | countdowns[key.countdownKey]?.timer?.cancel()
134 | countdowns[key.countdownKey]?.timer = nil
135 | countdowns[key.countdownKey]?.callBack = nil
136 | countdowns.removeValue(forKey: key.countdownKey)
137 | lock.unlock()
138 | }
139 |
140 | private func resume(key: Countdownable) {
141 | lock.lock()
142 | countdowns[key.countdownKey]?.timer?.resume()
143 | lock.unlock()
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/CountdownTimer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CountdownTimer.swift
3 | //
4 | // Created by wuhao on 2019/10/27.
5 | // Copyright © 2019 wuhao. All rights reserved.
6 | // https://github.com/remember17/CountdownTimer
7 |
8 | import UIKit
9 |
10 | public protocol Countdownable {
11 | var countdownKey: String { get }
12 | }
13 |
14 | public class CountdownTimer {
15 | private struct Countdown {
16 | var key: Countdownable
17 | var endTimeInterval: TimeInterval
18 | var timer: DispatchSourceTimer?
19 | var callBack: CountdownCallback?
20 | var currentCount = 0
21 | }
22 | public typealias CountdownCallback = (_ count: Int, _ finished: Bool) -> Void
23 | private var countdowns = [String: Countdown]()
24 | private var scenarioCallbacks = [String: CountdownCallback]()
25 | private var subscribedScenarioKeys = [String: String]()
26 | static private let shared = CountdownTimer()
27 | private let lock = NSLock()
28 |
29 | public static func start(key: Countdownable,
30 | count: Int,
31 | callBack: @escaping CountdownCallback) {
32 | let endTimeInterval = TimeInterval(count) + Date().timeIntervalSince1970
33 | let timer = CountdownTimer.shared.createTimer(key: key, endTimeInterval: endTimeInterval)
34 | CountdownTimer.shared.addCountdown(key: key, countdown: Countdown(key: key,
35 | endTimeInterval: endTimeInterval,
36 | timer: timer,
37 | callBack: callBack))
38 | CountdownTimer.shared.resume(key: key)
39 | }
40 |
41 | public static func cancel(key: Countdownable) {
42 | CountdownTimer.shared.remove(key: key)
43 | }
44 |
45 | public static func subscribe(key: Countdownable,
46 | for scenario: String,
47 | callBack: @escaping CountdownCallback) {
48 | CountdownTimer.shared.addScenarioCallback(key: key, for: scenario, callBack: callBack)
49 | }
50 |
51 | public static func unsubscribe(scenario: String) {
52 | CountdownTimer.shared.removeScenarioCallback(scenario: scenario)
53 | }
54 | }
55 |
56 | extension CountdownTimer {
57 | private func createTimer(key: Countdownable, endTimeInterval: TimeInterval) -> DispatchSourceTimer? {
58 | let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.global())
59 | timer.schedule(wallDeadline: .now(), repeating: 1)
60 | timer.setEventHandler(handler: {
61 | let currentTimeInterval = Date().timeIntervalSince1970
62 | var countdown = Int(round(endTimeInterval - currentTimeInterval))
63 | countdown -= 1
64 | let result = max(countdown, 0)
65 | DispatchQueue.main.async {
66 | self.handleCallback(key, result, result == 0)
67 | }
68 | })
69 | return timer
70 | }
71 |
72 | private func handleCallback(_ key: Countdownable, _ count: Int, _ finished: Bool) {
73 | guard var countdown = getCountdown(key: key),
74 | let callback = countdown.callBack else {
75 | remove(key: key)
76 | return
77 | }
78 | countdown.currentCount = count
79 | callback(count, finished)
80 | for (scenario, countdownKey) in subscribedScenarioKeys {
81 | if countdownKey == key.countdownKey,
82 | let scenarioCallback = getSubscribedInfo(scenario: scenario).scenarioCallback {
83 | scenarioCallback(count, finished)
84 | }
85 | }
86 | guard finished else { return }
87 | remove(key: key)
88 | }
89 | }
90 |
91 | extension CountdownTimer {
92 | private func addCountdown(key: Countdownable,
93 | countdown: Countdown) {
94 | lock.lock()
95 | countdowns[key.countdownKey] = countdown
96 | lock.unlock()
97 | }
98 |
99 | private func getCountdown(key: Countdownable) -> Countdown? {
100 | lock.lock()
101 | let countdown = countdowns[key.countdownKey]
102 | lock.unlock()
103 | return countdown
104 | }
105 |
106 | private func addScenarioCallback(key: Countdownable,
107 | for scenario: String,
108 | callBack: @escaping CountdownCallback) {
109 | lock.lock()
110 | scenarioCallbacks[scenario] = callBack
111 | subscribedScenarioKeys[scenario] = key.countdownKey
112 | lock.unlock()
113 | }
114 |
115 | private func removeScenarioCallback(scenario: String) {
116 | lock.lock()
117 | scenarioCallbacks.removeValue(forKey: scenario)
118 | subscribedScenarioKeys.removeValue(forKey: scenario)
119 | lock.unlock()
120 | }
121 |
122 | private func getSubscribedInfo(scenario: String) -> (countdownKey: String?,
123 | scenarioCallback: CountdownCallback?) {
124 | lock.lock()
125 | let countdownKey = subscribedScenarioKeys[scenario]
126 | let callback = scenarioCallbacks[scenario]
127 | lock.unlock()
128 | return (countdownKey, callback)
129 | }
130 |
131 | private func remove(key: Countdownable) {
132 | lock.lock()
133 | countdowns[key.countdownKey]?.timer?.cancel()
134 | countdowns[key.countdownKey]?.timer = nil
135 | countdowns[key.countdownKey]?.callBack = nil
136 | countdowns.removeValue(forKey: key.countdownKey)
137 | lock.unlock()
138 | }
139 |
140 | private func resume(key: Countdownable) {
141 | lock.lock()
142 | countdowns[key.countdownKey]?.timer?.resume()
143 | lock.unlock()
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
26 |
33 |
39 |
45 |
51 |
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 |
--------------------------------------------------------------------------------
/Demo/CountdownTimerDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6801510F2365E35100EA61A0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6801510E2365E35100EA61A0 /* AppDelegate.swift */; };
11 | 680151112365E35100EA61A0 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680151102365E35100EA61A0 /* SceneDelegate.swift */; };
12 | 680151132365E35100EA61A0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680151122365E35100EA61A0 /* ViewController.swift */; };
13 | 680151162365E35100EA61A0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 680151142365E35100EA61A0 /* Main.storyboard */; };
14 | 680151182365E35300EA61A0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 680151172365E35300EA61A0 /* Assets.xcassets */; };
15 | 6801511B2365E35300EA61A0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 680151192365E35300EA61A0 /* LaunchScreen.storyboard */; };
16 | 680151242365E39900EA61A0 /* CountdownTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680151232365E39900EA61A0 /* CountdownTimer.swift */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXFileReference section */
20 | 6801510B2365E35100EA61A0 /* CountdownTimerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CountdownTimerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
21 | 6801510E2365E35100EA61A0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
22 | 680151102365E35100EA61A0 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; };
23 | 680151122365E35100EA61A0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
24 | 680151152365E35100EA61A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
25 | 680151172365E35300EA61A0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
26 | 6801511A2365E35300EA61A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
27 | 6801511C2365E35300EA61A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
28 | 680151232365E39900EA61A0 /* CountdownTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountdownTimer.swift; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 680151082365E35100EA61A0 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 680151022365E35100EA61A0 = {
43 | isa = PBXGroup;
44 | children = (
45 | 6801510D2365E35100EA61A0 /* CountdownTimerDemo */,
46 | 6801510C2365E35100EA61A0 /* Products */,
47 | );
48 | sourceTree = "";
49 | };
50 | 6801510C2365E35100EA61A0 /* Products */ = {
51 | isa = PBXGroup;
52 | children = (
53 | 6801510B2365E35100EA61A0 /* CountdownTimerDemo.app */,
54 | );
55 | name = Products;
56 | sourceTree = "";
57 | };
58 | 6801510D2365E35100EA61A0 /* CountdownTimerDemo */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 680151232365E39900EA61A0 /* CountdownTimer.swift */,
62 | 6801510E2365E35100EA61A0 /* AppDelegate.swift */,
63 | 680151102365E35100EA61A0 /* SceneDelegate.swift */,
64 | 680151122365E35100EA61A0 /* ViewController.swift */,
65 | 680151142365E35100EA61A0 /* Main.storyboard */,
66 | 680151172365E35300EA61A0 /* Assets.xcassets */,
67 | 680151192365E35300EA61A0 /* LaunchScreen.storyboard */,
68 | 6801511C2365E35300EA61A0 /* Info.plist */,
69 | );
70 | path = CountdownTimerDemo;
71 | sourceTree = "";
72 | };
73 | /* End PBXGroup section */
74 |
75 | /* Begin PBXNativeTarget section */
76 | 6801510A2365E35100EA61A0 /* CountdownTimerDemo */ = {
77 | isa = PBXNativeTarget;
78 | buildConfigurationList = 6801511F2365E35300EA61A0 /* Build configuration list for PBXNativeTarget "CountdownTimerDemo" */;
79 | buildPhases = (
80 | 680151072365E35100EA61A0 /* Sources */,
81 | 680151082365E35100EA61A0 /* Frameworks */,
82 | 680151092365E35100EA61A0 /* Resources */,
83 | );
84 | buildRules = (
85 | );
86 | dependencies = (
87 | );
88 | name = CountdownTimerDemo;
89 | productName = CountdownTimerDemo;
90 | productReference = 6801510B2365E35100EA61A0 /* CountdownTimerDemo.app */;
91 | productType = "com.apple.product-type.application";
92 | };
93 | /* End PBXNativeTarget section */
94 |
95 | /* Begin PBXProject section */
96 | 680151032365E35100EA61A0 /* Project object */ = {
97 | isa = PBXProject;
98 | attributes = {
99 | LastSwiftUpdateCheck = 1110;
100 | LastUpgradeCheck = 1110;
101 | ORGANIZATIONNAME = wuhao;
102 | TargetAttributes = {
103 | 6801510A2365E35100EA61A0 = {
104 | CreatedOnToolsVersion = 11.1;
105 | };
106 | };
107 | };
108 | buildConfigurationList = 680151062365E35100EA61A0 /* Build configuration list for PBXProject "CountdownTimerDemo" */;
109 | compatibilityVersion = "Xcode 9.3";
110 | developmentRegion = en;
111 | hasScannedForEncodings = 0;
112 | knownRegions = (
113 | en,
114 | Base,
115 | );
116 | mainGroup = 680151022365E35100EA61A0;
117 | productRefGroup = 6801510C2365E35100EA61A0 /* Products */;
118 | projectDirPath = "";
119 | projectRoot = "";
120 | targets = (
121 | 6801510A2365E35100EA61A0 /* CountdownTimerDemo */,
122 | );
123 | };
124 | /* End PBXProject section */
125 |
126 | /* Begin PBXResourcesBuildPhase section */
127 | 680151092365E35100EA61A0 /* Resources */ = {
128 | isa = PBXResourcesBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | 6801511B2365E35300EA61A0 /* LaunchScreen.storyboard in Resources */,
132 | 680151182365E35300EA61A0 /* Assets.xcassets in Resources */,
133 | 680151162365E35100EA61A0 /* Main.storyboard in Resources */,
134 | );
135 | runOnlyForDeploymentPostprocessing = 0;
136 | };
137 | /* End PBXResourcesBuildPhase section */
138 |
139 | /* Begin PBXSourcesBuildPhase section */
140 | 680151072365E35100EA61A0 /* Sources */ = {
141 | isa = PBXSourcesBuildPhase;
142 | buildActionMask = 2147483647;
143 | files = (
144 | 680151132365E35100EA61A0 /* ViewController.swift in Sources */,
145 | 680151242365E39900EA61A0 /* CountdownTimer.swift in Sources */,
146 | 6801510F2365E35100EA61A0 /* AppDelegate.swift in Sources */,
147 | 680151112365E35100EA61A0 /* SceneDelegate.swift in Sources */,
148 | );
149 | runOnlyForDeploymentPostprocessing = 0;
150 | };
151 | /* End PBXSourcesBuildPhase section */
152 |
153 | /* Begin PBXVariantGroup section */
154 | 680151142365E35100EA61A0 /* Main.storyboard */ = {
155 | isa = PBXVariantGroup;
156 | children = (
157 | 680151152365E35100EA61A0 /* Base */,
158 | );
159 | name = Main.storyboard;
160 | sourceTree = "";
161 | };
162 | 680151192365E35300EA61A0 /* LaunchScreen.storyboard */ = {
163 | isa = PBXVariantGroup;
164 | children = (
165 | 6801511A2365E35300EA61A0 /* Base */,
166 | );
167 | name = LaunchScreen.storyboard;
168 | sourceTree = "";
169 | };
170 | /* End PBXVariantGroup section */
171 |
172 | /* Begin XCBuildConfiguration section */
173 | 6801511D2365E35300EA61A0 /* Debug */ = {
174 | isa = XCBuildConfiguration;
175 | buildSettings = {
176 | ALWAYS_SEARCH_USER_PATHS = NO;
177 | CLANG_ANALYZER_NONNULL = YES;
178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
180 | CLANG_CXX_LIBRARY = "libc++";
181 | CLANG_ENABLE_MODULES = YES;
182 | CLANG_ENABLE_OBJC_ARC = YES;
183 | CLANG_ENABLE_OBJC_WEAK = YES;
184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
185 | CLANG_WARN_BOOL_CONVERSION = YES;
186 | CLANG_WARN_COMMA = YES;
187 | CLANG_WARN_CONSTANT_CONVERSION = YES;
188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
191 | CLANG_WARN_EMPTY_BODY = YES;
192 | CLANG_WARN_ENUM_CONVERSION = YES;
193 | CLANG_WARN_INFINITE_RECURSION = YES;
194 | CLANG_WARN_INT_CONVERSION = YES;
195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
200 | CLANG_WARN_STRICT_PROTOTYPES = YES;
201 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
203 | CLANG_WARN_UNREACHABLE_CODE = YES;
204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
205 | COPY_PHASE_STRIP = NO;
206 | DEBUG_INFORMATION_FORMAT = dwarf;
207 | ENABLE_STRICT_OBJC_MSGSEND = YES;
208 | ENABLE_TESTABILITY = YES;
209 | GCC_C_LANGUAGE_STANDARD = gnu11;
210 | GCC_DYNAMIC_NO_PIC = NO;
211 | GCC_NO_COMMON_BLOCKS = YES;
212 | GCC_OPTIMIZATION_LEVEL = 0;
213 | GCC_PREPROCESSOR_DEFINITIONS = (
214 | "DEBUG=1",
215 | "$(inherited)",
216 | );
217 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
218 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
219 | GCC_WARN_UNDECLARED_SELECTOR = YES;
220 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
221 | GCC_WARN_UNUSED_FUNCTION = YES;
222 | GCC_WARN_UNUSED_VARIABLE = YES;
223 | IPHONEOS_DEPLOYMENT_TARGET = 13.1;
224 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
225 | MTL_FAST_MATH = YES;
226 | ONLY_ACTIVE_ARCH = YES;
227 | SDKROOT = iphoneos;
228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
230 | };
231 | name = Debug;
232 | };
233 | 6801511E2365E35300EA61A0 /* Release */ = {
234 | isa = XCBuildConfiguration;
235 | buildSettings = {
236 | ALWAYS_SEARCH_USER_PATHS = NO;
237 | CLANG_ANALYZER_NONNULL = YES;
238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
240 | CLANG_CXX_LIBRARY = "libc++";
241 | CLANG_ENABLE_MODULES = YES;
242 | CLANG_ENABLE_OBJC_ARC = YES;
243 | CLANG_ENABLE_OBJC_WEAK = YES;
244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
245 | CLANG_WARN_BOOL_CONVERSION = YES;
246 | CLANG_WARN_COMMA = YES;
247 | CLANG_WARN_CONSTANT_CONVERSION = YES;
248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
251 | CLANG_WARN_EMPTY_BODY = YES;
252 | CLANG_WARN_ENUM_CONVERSION = YES;
253 | CLANG_WARN_INFINITE_RECURSION = YES;
254 | CLANG_WARN_INT_CONVERSION = YES;
255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
260 | CLANG_WARN_STRICT_PROTOTYPES = YES;
261 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
263 | CLANG_WARN_UNREACHABLE_CODE = YES;
264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
265 | COPY_PHASE_STRIP = NO;
266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
267 | ENABLE_NS_ASSERTIONS = NO;
268 | ENABLE_STRICT_OBJC_MSGSEND = YES;
269 | GCC_C_LANGUAGE_STANDARD = gnu11;
270 | GCC_NO_COMMON_BLOCKS = YES;
271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
273 | GCC_WARN_UNDECLARED_SELECTOR = YES;
274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
275 | GCC_WARN_UNUSED_FUNCTION = YES;
276 | GCC_WARN_UNUSED_VARIABLE = YES;
277 | IPHONEOS_DEPLOYMENT_TARGET = 13.1;
278 | MTL_ENABLE_DEBUG_INFO = NO;
279 | MTL_FAST_MATH = YES;
280 | SDKROOT = iphoneos;
281 | SWIFT_COMPILATION_MODE = wholemodule;
282 | SWIFT_OPTIMIZATION_LEVEL = "-O";
283 | VALIDATE_PRODUCT = YES;
284 | };
285 | name = Release;
286 | };
287 | 680151202365E35300EA61A0 /* Debug */ = {
288 | isa = XCBuildConfiguration;
289 | buildSettings = {
290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
291 | CODE_SIGN_STYLE = Automatic;
292 | INFOPLIST_FILE = CountdownTimerDemo/Info.plist;
293 | LD_RUNPATH_SEARCH_PATHS = (
294 | "$(inherited)",
295 | "@executable_path/Frameworks",
296 | );
297 | PRODUCT_BUNDLE_IDENTIFIER = wuhao.CountdownTimerDemo;
298 | PRODUCT_NAME = "$(TARGET_NAME)";
299 | SWIFT_VERSION = 5.0;
300 | TARGETED_DEVICE_FAMILY = "1,2";
301 | };
302 | name = Debug;
303 | };
304 | 680151212365E35300EA61A0 /* Release */ = {
305 | isa = XCBuildConfiguration;
306 | buildSettings = {
307 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
308 | CODE_SIGN_STYLE = Automatic;
309 | INFOPLIST_FILE = CountdownTimerDemo/Info.plist;
310 | LD_RUNPATH_SEARCH_PATHS = (
311 | "$(inherited)",
312 | "@executable_path/Frameworks",
313 | );
314 | PRODUCT_BUNDLE_IDENTIFIER = wuhao.CountdownTimerDemo;
315 | PRODUCT_NAME = "$(TARGET_NAME)";
316 | SWIFT_VERSION = 5.0;
317 | TARGETED_DEVICE_FAMILY = "1,2";
318 | };
319 | name = Release;
320 | };
321 | /* End XCBuildConfiguration section */
322 |
323 | /* Begin XCConfigurationList section */
324 | 680151062365E35100EA61A0 /* Build configuration list for PBXProject "CountdownTimerDemo" */ = {
325 | isa = XCConfigurationList;
326 | buildConfigurations = (
327 | 6801511D2365E35300EA61A0 /* Debug */,
328 | 6801511E2365E35300EA61A0 /* Release */,
329 | );
330 | defaultConfigurationIsVisible = 0;
331 | defaultConfigurationName = Release;
332 | };
333 | 6801511F2365E35300EA61A0 /* Build configuration list for PBXNativeTarget "CountdownTimerDemo" */ = {
334 | isa = XCConfigurationList;
335 | buildConfigurations = (
336 | 680151202365E35300EA61A0 /* Debug */,
337 | 680151212365E35300EA61A0 /* Release */,
338 | );
339 | defaultConfigurationIsVisible = 0;
340 | defaultConfigurationName = Release;
341 | };
342 | /* End XCConfigurationList section */
343 | };
344 | rootObject = 680151032365E35100EA61A0 /* Project object */;
345 | }
346 |
--------------------------------------------------------------------------------