I finally took a look at objc_utils today. I didn't know where to begin so I found an example which I thought would be useful for me on the apple developer site using EventKit.
Here is the example site and I'm looking at the example of retrieving events from the EKEventStore using a predicate.
I have no clue what is going on. Here's what I have so far. I know there are problems, but I don't know why. I am also not sure if I have the syntax correct.
If anyone could help with this I would appreciate some suggestions and even explanations of how to use objc_util. I've read through the documentation a bit, but I'm afraid it's a little bit over my head.
If I'm able to have a list of events from my calendar to manipulate in Pythonista it is quite practical...
Thanks everyone!
from objc_util import *
store = ObjCClass('EKEventStore').alloc().init()
#store._requestAccessForEntityType_() #there needs to be permission granted to access the calendar, not sure exactly how to implement that.
cal = ObjCClass('NSCalendar').currentCalendar()
oneDayAgoComponents = ObjCClass('NSDateComponents').alloc().init()
oneDayAgoComponents.day = -1
date = ObjCClass('NSDate')
oneDayAgo = cal.dateByAddingComponents_toDate_options_(oneDayAgoComponents, date, 0)
#oneDayAge is None??
oneYearFromNowComponents = ObjCClass('NSDateComponents').alloc().init()
oneYearFromNowComponents.year = 1
oneYearFromNow = cal.dateByAddingComponents_toDate_options_(oneDayAgoComponents, date, 0)
#oneYearFromNow is None??
#predicate = store.predicateForEventsWithStartDate_endDate_calendars_(oneDayAgo, oneYearFromNow, None)
#this predicate line ^^ crashes pythonista