Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
ec094f8c
Commit
ec094f8c
authored
May 15, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added alarm creation methods to the Events API
parent
dcbc1497
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
Sources/iOS/Events/Events.swift
+48
-0
No files found.
Sources/iOS/Events/Events.swift
View file @
ec094f8c
...
@@ -549,3 +549,51 @@ extension Events {
...
@@ -549,3 +549,51 @@ extension Events {
}
}
}
}
}
}
extension
Events
{
/**
Creates an alarm using the current time plus a given timeInterval.
- Parameter timeIntervalSinceNow: A TimeInterval.
- Returns: An EKAlarm.
*/
open
func
createAlarm
(
timeIntervalSinceNow
:
TimeInterval
)
->
EKAlarm
{
return
EKAlarm
(
absoluteDate
:
Date
(
timeIntervalSinceNow
:
timeIntervalSinceNow
))
}
/**
Creates an alarm using given date components.
- Parameter day: An optional Int.
- Parameter month: An optional Int.
- Parameter year: An optional Int.
- Parameter hour: An optional Int.
- Parameter minute: An optional Int.
- Parameter second: An optional Int.
- Returns: An optional EKAlarm.
*/
open
func
createAlarm
(
day
:
Int
?
=
nil
,
month
:
Int
?
=
nil
,
year
:
Int
?
=
nil
,
hour
:
Int
?
=
nil
,
minute
:
Int
?
=
nil
,
second
:
Int
?
=
nil
)
->
EKAlarm
?
{
var
dateComponents
=
DateComponents
()
dateComponents
.
calendar
=
Calendar
.
current
dateComponents
.
day
=
day
dateComponents
.
month
=
month
dateComponents
.
year
=
year
dateComponents
.
hour
=
hour
dateComponents
.
minute
=
minute
dateComponents
.
second
=
second
guard
let
v
=
dateComponents
.
date
else
{
return
nil
}
return
EKAlarm
(
absoluteDate
:
v
)
}
/**
Creates an alarm using a relative offset from the start date.
- Parameter relativeOffset offset: A TimeInterval.
- Returns: An EKAlarm.
*/
open
func
createAlarm
(
relativeOffset
offset
:
TimeInterval
)
->
EKAlarm
{
return
EKAlarm
(
relativeOffset
:
offset
)
}
}
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