You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
show-lists doesn't include custom 'smart lists' #72
This seems to be a limitation of the Apple Reminders API itself not including Smart Lists.
I haven't verified this, but ChatGPT seems to suggest that they may need to be manually implemented as filters:
Full ChatGPT Response
To access smart lists using the Apple Reminders API, you'll need to interact with the API through Apple's frameworks, such as EventKit for iOS and macOS. Smart lists in Apple Reminders are special lists like "Today", "Scheduled", "All", etc., that automatically categorize reminders based on certain criteria.
Here's a general approach to accessing smart lists:
Import EventKit: First, you need to import the EventKit framework into your project. This framework provides the necessary classes and methods to interact with calendar and reminders data.
Request Access: Request access to the user's reminders. You need to ensure your app has the appropriate permissions to access reminder data.
Fetch Reminders: Once you have access, you can fetch reminders. However, Apple's EventKit does not provide a direct way to access smart lists by their usual names like "Today" or "Scheduled". Instead, you have to manually filter the reminders based on the criteria that define these smart lists. For example, for the "Today" smart list, you would filter reminders whose due dates are today.
Here's a basic outline of how you might do this in Swift (for iOS/macOS):
import EventKit
leteventStore=EKEventStore()
// Request access to reminders
eventStore.requestAccess(to:.reminder){(granted, error)inif granted && error ==nil{
// Fetch all reminders
letpredicate= eventStore.predicateForReminders(in:nil)
eventStore.fetchReminders(matching: predicate){(reminders)in
// Filter reminders based on your criteria for a smart list
lettodayReminders= reminders?.filter{guardlet dueDate = $0.dueDateComponents?.date else{returnfalse}returnCalendar.current.isDateInToday(dueDate)}
// Do something with the filtered reminders
}}else{
// Handle the error or the case where access is not granted
}}
In this code snippet, we:
Import EventKit.
Request access to reminders.
Fetch all reminders and filter them to match the "Today" smart list criteria.
Remember that this is just a basic example. You'll need to tailor your filtering logic to match the specific criteria of the smart list you're interested in. Additionally, always handle permissions and potential errors appropriately in a production environment.
For a more comprehensive solution, you might consider creating custom functions or classes to encapsulate the logic for different smart lists.
After some investigation it seems that Tags themselves aren't exposed in the API for the EKReminders class. The ChatGPT example uses the very specific case of Today, Tomorrow and other Scheduled events to "tag" them by their due dates. Guess we'll just have to wait for Apple's Reminders API to catch up to the features
After some investigation it seems that Tags themselves aren't exposed in the API for the EKReminders class
@naafiyan When you say 'tags', what specifically are you referring to? Do you mean the specific 'hashtags' tags assigned to a reminder? Or are you referring to something else?
The rules for smart lists can have many different aspects, not just tags, so even if they aren't currently accessible, the others may be:
Tags
Date
Time
Priority
Flag
Location
List
That said, I also don't think there is a way to access the underlying rules that make up a smart list currently, so it would sort of be a manual process to implement these with various filters/etc (perhaps being able to create/save 'filter aliases' in this app would be useful for that?)
Within that I can see the tags information in the ZREMCDHASHTAGLABEL table.
The ZREMCDOBJECT table seems to contain a lot of data, possibly related to the reminders themselves? The ZNAME1 column seems to include some of the tags as well.
The ZREMCDREMINDER table seems to have a lot of the actual reminder data, and seemingly foreign keys to link to some of the other tables.
While I wouldn't personally risk writing to this DB for fear of corrupting it or similar; it might be possible to extract some relevant details from it in a 'read only' mode, that could then be used to filter the reminders returned from the official API's 'in app'.
Or sometimes a UUID (eg. in my data: BA189B19-F050-43FD-A76F-115415ED91A2 / 5C703F5C-7ED3-4AC3-B064-7F9C1E01AA95)
25: seems to correlate to normal lists
ZBADGEEMBLEM seems to be the image I assigned to the normal lists (eg. {"Emoji" : "💲"})
ZNAME2 seems to be the name of the normal list
ZSORTINGSTYLE: eg. manual
24: seems to (at least partially?) correlate to hashtags for reminders
ZNAME1: seems to contain the text of a hashtag for the reminder
22: ???
21: ???
18: ?URL related?
Looks like ZUTI (eg. public.url), ZURL, etc; may be related to this..
ZURL: reminder URL field
17: ?attachment related?
Looks like ZUTI (eg. public.jpeg), ZFILENAME (eg. 24B9CB35-CC7F-45F0-B52F-8BED9C2F2769-732-00055908B19E5135.jpeg), ZSHA512SUM, etc; may be related to this..
10: ?location related?
Looks like ZLATITUDE / ZLONGITUDE / ZADDRESS / ZLOCATIONUID / ZTITLE etc are related to this
9: ?reminder date/time related?
Looks like ZALARM / ZDATECOMPONENTSDATA / etc may be related to this
7: ???
Looks like ZREMINDER / ZTRIGGER / Z8TRIGGER / etc may be related to this
6: ?settings/flags related?
I only seem to have a single entry for this type, and it seems to correlate with fields like ZDAALLOWSCALENDARADDDELETEMODIFY / ZDASUPPORTSSHAREDCALENDARS / etc (seemingly at least 10 fields like this seem to correlate with it), as well as ZCKUSERRECORDNAME, ZNAME (iCloud), ZPERSONID (PRIMARY-CLOUDKIT)
That seems to be enough basic info to figure out resolving both this issue, and maybe also #72
Would just need to figure out how to match up the ID/data that the API is currently able to provide, with an ID that can be looked up in the sqlite database; and then extract the associated hashtags/etc.
I was thinking that maybe externalId from reminders show Reminders --sort creation-date --sort-order ascending --format json might have worked.. but it only seems to show up in ZREMCDOBJECT within some fields with LOTS of other IDs in them, so doesn't seem ideal; though ZREMCDREMINDER seems to have a single row match with the ID being in ZCKIDENTIFIER / ZDACALENDARITEMUNIQUEIDENTIFIER, so maybe we can do it that way in like 2 steps..
Edit 3: Based on that blog post, we can correlate the Z_ENT30 with the Z_PRIMARYKEY table to see that it represents a REMCDSmartList, which has a superclass of REMCDObject (which explains why it's in that table). We can also see that Z_ENT25 is a REMCDList (also with a superclass of REMCDObject). Etc
Much, much better off using standard API's that are stable, documented, and thus far less brittle.
@cromulus When they exist; I'd agree with you 100%. But when they don't, or are limited and don't provide all of the things you'd like access to; that's what the above was exploring.
Activity
naafiyan commentedon Nov 28, 2023
This seems to be a limitation of the Apple Reminders API itself not including Smart Lists.
0xdevalias commentedon Nov 28, 2023
I haven't verified this, but ChatGPT seems to suggest that they may need to be manually implemented as filters:
Full ChatGPT Response
naafiyan commentedon Nov 28, 2023
After some investigation it seems that Tags themselves aren't exposed in the API for the EKReminders class. The ChatGPT example uses the very specific case of Today, Tomorrow and other Scheduled events to "tag" them by their due dates. Guess we'll just have to wait for Apple's Reminders API to catch up to the features
0xdevalias commentedon Nov 28, 2023
@naafiyan When you say 'tags', what specifically are you referring to? Do you mean the specific 'hashtags' tags assigned to a reminder? Or are you referring to something else?
The rules for smart lists can have many different aspects, not just tags, so even if they aren't currently accessible, the others may be:
That said, I also don't think there is a way to access the underlying rules that make up a smart list currently, so it would sort of be a manual process to implement these with various filters/etc (perhaps being able to create/save 'filter aliases' in this app would be useful for that?)
0xdevalias commentedon Nov 28, 2023
It looks like the underlying sqlite database backing the Reminders app is stored at:
/Users/devalias/Library/Reminders/Container_v1/Stores/Data-SOME-UUID-TYPE-THING.sqliteWithin that I can see the tags information in the
ZREMCDHASHTAGLABELtable.The
ZREMCDOBJECTtable seems to contain a lot of data, possibly related to the reminders themselves? TheZNAME1column seems to include some of the tags as well.The
ZREMCDREMINDERtable seems to have a lot of the actual reminder data, and seemingly foreign keys to link to some of the other tables.While I wouldn't personally risk writing to this DB for fear of corrupting it or similar; it might be possible to extract some relevant details from it in a 'read only' mode, that could then be used to filter the reminders returned from the official API's 'in app'.
0xdevalias commentedon Apr 1, 2024
Following on from my above research, looking at the sqlite DB that contains the reminders data:
Based on that, it should be possible to get a list of all of the normal lists from the
ZREMCDOBJECTtable like follows:Which for my data, returns 9 entries:
And then I can access my smart lists as follows:
Which for my data, returns 10 entries:
com.apple.reminders.smartlist.todaycom.apple.reminders.smartlist.flaggedcom.apple.reminders.smartlist.assignedcom.apple.reminders.smartlist.customEdit: Collated/cross-posted the above on the following gist for future reference: https://gist.github.com/0xdevalias/ccc2b083ff58b52aa701462f2cfb3cc8#accessing--exporting-apples-reminders-data-on-macos
Edit 2: Found this cool blog post laying out a lot of the specifics of how the internals of Apple CoreData based SQLite databases are laid out: https://fatbobman.com/en/posts/tables_and_fields_of_coredata/
Edit 3: Based on that blog post, we can correlate the
Z_ENT30with theZ_PRIMARYKEYtable to see that it represents aREMCDSmartList, which has a superclass ofREMCDObject(which explains why it's in that table). We can also see thatZ_ENT25is aREMCDList(also with a superclass ofREMCDObject). EtcEdit 4: I wrote a basic python script to extract the CoreData models + hierarchy from the
Z_PRIMARYKEYtable and display them as an indented markdown list: https://gist.github.com/0xdevalias/ccc2b083ff58b52aa701462f2cfb3cc8#file-extract-coredata-model-hierarchy-pyReminders SQLite CoreData Models + Associated tables
⇒ ./extract-coredata-model-hierarchy.py /Users/devalias/Library/Reminders/Container_v1/Stores/Data-5070B790-D66D-40F7-8F4A-EC8E0FA88F3A.sqlite - 1: REMCDAccountListData (Table: ZREMCDACCOUNTLISTDATA) - 2: REMCDChangeTrackingState (Table: ZREMCDCHANGETRACKINGSTATE) - 3: REMCDHashtagLabel (Table: ZREMCDHASHTAGLABEL) - 4: REMCDMigrationState (Table: ZREMCDMIGRATIONSTATE) - 5: REMCDObject (Table: ZREMCDOBJECT) - 6: REMCDAccount - 7: REMCDAlarm - 8: REMCDAlarmTrigger - 9: REMCDAlarmDateTrigger - 10: REMCDAlarmLocationTrigger - 11: REMCDAlarmTimeIntervalTrigger - 12: REMCDAlarmVehicleTrigger - 13: REMCDAssignment - 14: REMCDAttachment - 15: REMCDFileAttachment - 16: REMCDAudioAttachment - 17: REMCDImageAttachment - 18: REMCDURLAttachment - 19: REMCDAuxiliaryChangeInfo - 20: REMCDAuxiliaryReminderChangeInfo - 21: REMCDAuxiliaryReminderChangeDeleteInfo - 22: REMCDAuxiliaryReminderChangeMoveInfo - 23: REMCDCalDAVNotification - 24: REMCDHashtag - 25: REMCDList - 26: REMCDManualSortHint_v1 - 27: REMCDRecurrenceRule - 28: REMCDSharedToMeReminderPlaceholder - 29: REMCDSharee - 30: REMCDSmartList - 31: REMCDPublicTemplate (Table: ZREMCDPUBLICTEMPLATE) - 32: REMCDReminder (Table: ZREMCDREMINDER) - 33: REMCDReplicaManager (Table: ZREMCDREPLICAMANAGER) - 34: REMCDSavedAttachment (Table: ZREMCDSAVEDATTACHMENT) - 35: REMCDSavedReminder (Table: ZREMCDSAVEDREMINDER) - 36: REMCDTemplate (Table: ZREMCDTEMPLATE) - 37: REMCDTemplateOperationQueueItem (Table: ZREMCDTEMPLATEOPERATIONQUEUEITEM) - 38: REMCKCloudState (Table: ZREMCKCLOUDSTATE) - 39: REMCKServerChangeToken (Table: ZREMCKSERVERCHANGETOKEN) - 40: REMCKSharedEntitySyncActivity (Table: ZREMCKSHAREDENTITYSYNCACTIVITY) - 41: REMCKSharedObjectOwnerName (Table: ZREMCKSHAREDOBJECTOWNERNAME) - 16001: CHANGE - 16002: TRANSACTION - 16003: TRANSACTIONSTRINGcromulus commentedon Oct 25, 2024
From prior adventures in accessing the underlying sqlite db for apple apps (notes), it is, in my humble opinion, a huge headache.
Much, much better off using standard API's that are stable, documented, and thus far less brittle.
0xdevalias commentedon Oct 25, 2024
@cromulus When they exist; I'd agree with you 100%. But when they don't, or are limited and don't provide all of the things you'd like access to; that's what the above was exploring.
cromulus commentedon Jan 22, 2025
Yuuup. I feel you. That's why I was doing the same sort of archaeology in the notes sqlitedb.