Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangyongji
/
MRFramework
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
337d97d3
authored
Oct 10, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加延迟执行扩展
parent
9b9cff45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
MRFramework/MRFramework/Extensions/Foundation/Date+util.swift
+20
-6
No files found.
MRFramework/MRFramework/Extensions/Foundation/Date+util.swift
View file @
337d97d3
...
...
@@ -125,6 +125,26 @@ extension TimeInterval {
public
func
`
repeat
`
(
_
handler
:
@escaping
CountdownRepeatingBlock
)
->
Countdown
{
return
Countdown
(
repeatInSec
:
self
)
.
repeat
(
handler
)
}
public
func
asyncAfterSec
(
_
inQueue
:
DispatchQueue
=
.
main
,
execute
:
@escaping
()
->
Void
)
{
inQueue
.
asyncAfter
(
deadline
:
.
now
()
+
.
seconds
(
Int
(
self
)),
execute
:
execute
)
}
public
func
asyncAfterMilliSec
(
_
inQueue
:
DispatchQueue
=
.
main
,
execute
:
@escaping
()
->
Void
)
{
inQueue
.
asyncAfter
(
deadline
:
.
now
()
+
.
milliseconds
(
Int
(
self
)),
execute
:
execute
)
}
}
extension
DispatchTimeInterval
{
public
func
asyncAfter
(
_
inQueue
:
DispatchQueue
=
.
main
,
execute
:
@escaping
()
->
Void
)
{
inQueue
.
asyncAfter
(
deadline
:
.
now
()
+
self
,
execute
:
execute
)
}
}
extension
Int
{
public
func
countup
(
stop
:
CountdownSecUpStopBlock
?,
handler
:
@escaping
CountdownHandler
)
->
Countdown
{
return
Countdown
()
.
limitCound
(
self
)
.
inSecond
(
.
up
(
1
,
stop
))
.
handler
(
handler
)
}
}
public
enum
CountdownSec
{
...
...
@@ -323,9 +343,3 @@ extension Countdown {
return
(
Int
(
day
),
Int
(
hour
),
Int
(
minute
),
Int
(
second
))
}
}
extension
Int
{
public
func
countup
(
stop
:
CountdownSecUpStopBlock
?,
handler
:
@escaping
CountdownHandler
)
->
Countdown
{
return
Countdown
()
.
limitCound
(
self
)
.
inSecond
(
.
up
(
1
,
stop
))
.
handler
(
handler
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment