Sub GetCalendars As Map
Dim res As Map
res.Initialize
Dim no As NativeObject = store
Dim Cals As List = no.GetField("store").RunMethod("calendarsForEntityType:", Array(0))
For Each Cal As NativeObject In Cals
res.Put(Cal.GetField("title"), Cal)
Next
Return res
End Sub
Sub CreateNewCalendar(Title As String)
Dim nstore As NativeObject = store
nstore = nstore.GetField("store")
Dim Cal As NativeObject
Cal = Cal.Initialize("EKCalendar").RunMethod("calendarForEntityType:eventStore:", Array(0, nstore))
Cal.SetField("title", Title)
Cal.SetField("source", nstore.GetField("defaultCalendarForNewEvents").GetField("source"))
Dim nme As NativeObject = Me
Dim Success As Boolean = nme.RunMethod("SaveCalendar::", Array(Cal, nstore)).AsBoolean
Log(Success)
End Sub
#if OBJC
-(BOOL)SaveCalendar:(EKCalendar*)cal :(EKEventStore*)store {
NSError* e;
BOOL res = [store saveCalendar:cal commit:true error:&e];
if (e != nil) {
NSLog(@"Error saving calendar: %@", e);
}
return res;
}
#End If