RustemAqtau

RustemAqtau

How to convert iOS date to Rrule format?

How to convert time recurrence(daily, weekly, monthly, etc) to Rrule format and send to backend? Ex:

"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"

Do you using libraries for this in Swift?

2 720 2

Most Liked

godofbiscuits

godofbiscuits

It depends on where you’re getting your recurrences from? I don’t recall any Apple-specific recurrence mechanisms on the level of calendars like you’re describing. But eventually if you have date objects, you’ll want to use DateComponents to extract the kind of data you’re describing (I don’t know what RRules are)
How you get a DateComponents object is below. See the docs for how to extract the individual months, days etc.

let date = Date()
var calendar = Locale.current.calendar
var dateComponents = calendar.dateComponents(Set<Calendar.Component>(), from: date)

Popular I Os topics Top

bot
Apple’s Swift has far-reaching effects on all platforms, not just iOS, OS X, watchOS, and tvOS. Learn why Swift matters, how to use the p...
1 679 0
New
First poster: bot
A new Swift blog post/announcement has been posted! Get the full details here: Swift.org - Diversity in Swift
0 920 0
New
NewsBot
A new Swift blog post/announcement has been posted! Get the full details here: Swift.org - Announcing the Swift Mentorship Program
2 1092 1
New
First poster: bot
A new Swift blog post/announcement has been posted! Get the full details here: https://swift.org/blog/swift-5-5-released/
0 752 0
New
First poster: bot
A new Swift blog post/announcement has been posted! Get the full details here: Swift.org - Swift-DocC is Now Open Source
0 738 0
New
Exadra37
This past weekend saw the latest competition take place and the newest iPhone, the iPhone 13 Pro running the latest and fully patched ver...
6 1096 1
New
First poster: bot
A new Swift blog post/announcement has been posted! Get the full details here: Swift.org - Swift Extension for Visual Studio Code
0 830 0
New
RustemAqtau
Is Appcode worth it or XCode is enough for iOS App Development?
12 806 5
New
First poster: bot
A new Swift blog post/announcement has been posted! Get the full details here: Swift.org - Announcing SwiftNIO IMAP
0 810 0
New
NewsBot
A new Swift blog post/announcement has been posted! Get the full details here: https://swift.org/blog/using-upcoming-feature-flags/
0 201 0
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
144 8222 50
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
51 4075 20
New
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
10 5357 8
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
200 3360 78
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
78 3397 24
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
21 4448 7
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
37 2493 14
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
4 4600 0
New
AstonJ
Chris Seaton, the creator of TruffleRuby has died. It appears from suicide :cry: He left this note on Twitter on the weekend: And one...
4 2131 2
New