(Creating the Cephei page.) |
m (Fixing package id, adding link to CepheiPrefs, turning links into a bullet list.) |
||
Line 2: | Line 2: | ||
|developer=HASHBANG | |developer=HASHBANG | ||
|version=1.16 | |version=1.16 | ||
|package= | |package=ws.hbang.common | ||
}} | }} | ||
Cephei is a framework that provides various convenience methods. | Cephei is a framework that provides various convenience methods. | ||
Line 30: | Line 30: | ||
Add to your package’s control file: | Add to your package’s control file: | ||
<code>ws.hbang.common</code> to the <code>Depends</code> field | <code>ws.hbang.common</code> to the <code>Depends</code> field. | ||
== Getting a tweak’s preferences == | == Getting a tweak’s preferences == | ||
Line 58: | Line 58: | ||
<syntaxhighlight lang="objc">UIColor *color = [UIColor hb_colorWithPropertyListValue:@"#ffa1aa"];</syntaxhighlight> | <syntaxhighlight lang="objc">UIColor *color = [UIColor hb_colorWithPropertyListValue:@"#ffa1aa"];</syntaxhighlight> | ||
== See also == | |||
* [[CepheiPrefs]] | |||
== External links == | == External links == | ||
[https://github.com/hbang/libcephei Cephei’s source code] | * [https://github.com/hbang/libcephei Cephei’s source code] | ||
[https://hbang.github.io/libcephei/index.html Cephei’s documentation] | * [https://hbang.github.io/libcephei/index.html Cephei’s documentation] |
Revision as of 14:15, 15 May 2021
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.
Dragon
Add to your DragonMake file:
Cephei
to the frameworks
variable in any module.
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"];