Skip to content

Instantly share code, notes, and snippets.

View RedenticDev's full-sized avatar
💤
Paused tweaks to focus on time-consuming big projects

Redentic RedenticDev

💤
Paused tweaks to focus on time-consuming big projects
View GitHub Profile
// Bigger iPhones = any Max, any Plus, iPhone XR, iPhone 11
switch (UITraitCollection.current.horizontalSizeClass, UITraitCollection.current.verticalSizeClass) {
case (.compact, .compact):
// Smaller iPhones in landscape
case (.compact, .regular):
// iPhones in portrait
// iPads in portrait during any split screen,
@shepgoba
shepgoba / yeet.c
Last active July 13, 2023 14:06
actual battery health algorithm as of ios 13.3
//requires: com.apple.private.iokit.batterydata entitlement
extern "C"
CFArrayRef IOPSCopyPowerSourcesByType(int type);
int healthPercent;
NSArray *sources = (__bridge NSArray *)IOPSCopyPowerSourcesByType(1);
NSDictionary *batteryDict = sources[0];
if (sources && sources.count && batteryDict[@"Maximum Capacity Percent"]) {
@Esquilli
Esquilli / iOS13 font picker example
Last active June 19, 2021 17:09
How to use iOS13 font picker
// Add this to your preferences class
-(void)pickFont {
UIFontPickerViewControllerConfiguration *config = [[UIFontPickerViewControllerConfiguration alloc] init];
config.includeFaces = YES;
config.displayUsingSystemFont = NO;
UIFontPickerViewController *fontPicker = [[UIFontPickerViewController alloc] initWithConfiguration:config];
fontPicker.delegate = self;
[self presentViewController:fontPicker animated:YES completion:nil];
}