Cephei: Difference between revisions

From iPhone Development Wiki
m (Fixing package id, adding link to CepheiPrefs, turning links into a bullet list.)
Line 19: Line 19:


<code>Cephei</code> to the <code>XXX_EXTRA_FRAMEWORKS</code> variable.
<code>Cephei</code> to the <code>XXX_EXTRA_FRAMEWORKS</code> variable.
=== Dragon ===
Add to your DragonMake file:
<code>Cephei</code> to the <code>frameworks</code> variable in any module.


=== Packaging ===
=== Packaging ===

Revision as of 03:21, 21 July 2022

Cephei
Cydia Package
Developer HASHBANG
Package ID ws.hbang.common
Latest Version 1.16

Cephei is a framework that provides various convenience methods.

How to use this framework

Headers are available from Cephei’s Github project and the framework can be found at /Library/Frameworks/Cephei.framework on a device where Cephei is installed. Theos and Dragon both include the headers so you don’t have to worry about installing them!

Include directive

#import <Cephei/Cephei.h>

Makefile

Add to your Makefile:

Cephei to the XXX_EXTRA_FRAMEWORKS variable.

Packaging

Add to your package’s control file:

ws.hbang.common to the Depends field.

Getting a tweak’s preferences

The HBPreferences class allows for easy access to preferences. Note: Cephei does not allow you to access most Apple preferences (preferences that have their identifier starting with com.apple).

%ctor {
    // The identifier must be the preference identifier of the bundle wanted
    HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:@"com.example.ExamaplePreference"];
    // Getting the value of a cell with the key of enabled
    BOOL enabled;
    // Returns the value set for the key, or default set in preferences if no value has been set. If no default, returns nil
    enabled = [preferences boolForKey:@"enabled"];
    // The register methods automatically update the variable that gets passed to them. If no preference has been set, the variable is set to the default passed
    [preferences registerBool:enabled default:YES forKey:@"enabled"];
}

In order to have the -registerObject:default:forKey methods to automatically update, a notification, set to the preference identifier with /ReloadPrefs appended, needs be posted.

<dict>
<!-- Interesting preference cell -->
    <key>PostNotification</key>
    <string>com.example.ExamaplePreference/ReloadPrefs</string>
</dict>

Converting hex color to UIColor

Cephei provides a method to easily convert CSS style hex color to UIColor.

UIColor *color = [UIColor hb_colorWithPropertyListValue:@"#ffa1aa"];

See also

External links