Below is a minimal Theos‐based tweak that hooks into the Contacts app’s “birthday” cell, computes the age at runtime and appends it to the date string. It’s written in Logos (Objective-C) and tested on iOS 12–14, but you may need to adjust the class name for newer OS versions (the private class name sometimes drifts).
— Directory layout —
.tweak/
├── control
├── Makefile
└── Tweak.xm
- control
Package: org.yourname.birthdayage
Name: BirthdayAge
Version: 0.1
Architecture: iphoneos-arm
Description: Shows age next to birthday in Contacts.app
Maintainer: Your Name <you@example.com>
Author: Your Name
Section: Tweaks
Depends: mobilesubstrate, firmware (>= 12.0)
- Makefile
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = BirthdayAge
BirthdayAge_FILES = Tweak.xm
BirthdayAge_FRAMEWORKS = UIKit ContactsUI Contacts
include $(THEOS_MAKE_PATH)/tweak.mk
- Tweak.xm
#import <UIKit/UIKit.h>
#import <Contacts/Contacts.h>
#import <ContactsUI/ContactsUI.h>
#import <objc/runtime.h>
// On iOS 12–14, the birthday cell class is named "CNContactDateItemCell".
// On newer iOS versions it may have a different prefix – use
// `cycript -p SpringBoard` or runtime introspection to find the real name.
%hook CNContactDateItemCell
// `-setDate:` is called when the cell receives a birthday NSDate.
- (void)setDate:(NSDate *)date {
// 1) Call original implementation so the cell's textLabel is set to e.g. "Jan 1, 1970"
%orig;
if (date) {
// 2) Compute age in years
NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents *components = [cal components:NSCalendarUnitYear
fromDate:date
toDate:[NSDate date]
options:0];
NSInteger age = components.year;
// 3) Append "(XX)" to the existing label
UILabel *detail = (UILabel *)[self valueForKey:@"_detailLabel"];
if (!detail) {
detail = self.detailTextLabel;
}
if (detail.text.length > 0) {
detail.text = [NSString stringWithFormat:@"%@ (%ld)", detail.text, (long)age];
}
}
}
%end
%ctor {
@autoreleasepool {
// Just in case the class name changed, we can test for it:
Class cls = objc_getClass("CNContactDateItemCell");
if (cls) {
NSLog(@"[BirthdayAge] hooking CNContactDateItemCell");
} else {
NSLog(@"[BirthdayAge] CNContactDateItemCell not found – tweak may not work on this iOS version");
}
}
}
— How it works —
- We hook the private
CNContactDateItemCell class, which Contacts.app uses to render date‐type properties (birthday, anniversary, etc.).
- In our hooked
-setDate: we first call %orig so ContactsUI formats and assigns the plain date text.
- We then compute the difference in years between the birthday and now via
NSCalendar.
- Finally we grab the cell’s detail‐label (
_detailLabel or fallback to detailTextLabel) and append “ (XX)” to the text.
Build & install with theos:
$ cd .tweak
$ make package install
Respring your device and open Contacts. On any contact with a birthday you’ll now see something like:
Jan 1, 1970 (51)
…where 51 is the computed age.
Feel free to tweak the hooked class name or logic if you’re targeting a newer iOS whose ContactsUI binaries have shifted private‐class names.