### HBPackageNameHeaderCell Example Usage (Gradient Background) Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of HBPackageNameHeaderCell in standard size with a gradient background. ```plist cell PSGroupCell headerCellClass HBPackageNameHeaderCell packageIdentifier ws.hbang.common backgroundGradientColors #5AD427 #FFDB4C #EF4DB6 #898C90 ``` -------------------------------- ### HBPackageTableCell Example Usage Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Examples demonstrating the typical usage of HBPackageTableCell, including with and without a subtitle, and specifying a custom repository. ```plist cellClass HBPackageTableCell label Cephei packageIdentifier ws.hbang.common ``` ```plist cellClass HBPackageTableCell label Cephei packageIdentifier ws.hbang.common subtitle Support library for tweaks ``` ```plist cellClass HBPackageTableCell label Cephei packageIdentifier ws.hbang.common packageRepository https://repo.chariz.io ``` -------------------------------- ### Create Dynamic UIColor with Interface Style Variants Example (Objective-C) Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Example demonstrating how to create a dynamic UIColor using a dictionary of interface style variants for light and dark modes. ```Objective-C UIColor *myColor = [UIColor hb_colorWithInterfaceStyleVariants:@{ @(UIUserInterfaceStyleLight): [UIColor systemRedColor], @(UIUserInterfaceStyleDark): [UIColor systemOrangeColor] }]; ``` -------------------------------- ### HBPackageNameHeaderCell Example Usage (Standard) Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of HBPackageNameHeaderCell in standard size, used within a PSGroupCell. ```plist cell PSGroupCell headerCellClass HBPackageNameHeaderCell packageIdentifier ws.hbang.common ``` -------------------------------- ### HBPackageNameHeaderCell Example Usage (Condensed) Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of HBPackageNameHeaderCell in condensed size, requiring an icon and package identifier. ```plist cell PSGroupCell condensed headerCellClass HBPackageNameHeaderCell icon icon.png packageIdentifier ws.hbang.common ``` -------------------------------- ### Create Dynamic Color with Specified Dark Variant Example (Objective-C) Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Example demonstrating how to create a dynamic color object where a specific UIColor is used for the dark interface style. ```Objective-C UIColor *myColor = [[UIColor systemRedColor] hb_colorWithDarkInterfaceVariant:[UIColor systemOrangeColor]]; ``` -------------------------------- ### HBPackageNameHeaderCell Example Usage (Custom Colors) Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of HBPackageNameHeaderCell in standard size with custom title and subtitle colors. ```plist cell PSGroupCell headerCellClass HBPackageNameHeaderCell packageIdentifier ws.hbang.common titleColor #CC0000 subtitleColor 55 147 230 ``` -------------------------------- ### Example Preference Specifier Dictionary Source: https://hbang.github.io/libcephei/Classes/HBAboutListController.html This dictionary configures a link cell to visit the developer's website. ```plist cell PSLinkCell cellClass HBLinkTableCell label Visit Website url https://hashbang.productions/ ``` ```plist cell PSGroupCell label Experiencing issues? ``` ```plist action hb_sendSupportEmail cell PSLinkCell label Email Support ``` ```plist cell PSGroupCell footerText If you like this tweak, please consider a donation. ``` ```plist cell PSLinkCell cellClass HBLinkTableCell label Donate url https://hashbang.productions/donate/ ``` -------------------------------- ### Cephei defaults Examples Source: https://hbang.github.io/libcephei/defaults.html Illustrates common use cases for the 'defaults' tool, including reading all preferences, reading a specific key, and writing a new preference value. ```bash Examples: defaults read com.apple.springboard defaults read com.apple.springboard SBBacklightLevel2 defaults write -g AppleLocale en_US defaults write com.apple.springboard SBBacklightLevel2 -float 0.5 ``` -------------------------------- ### HBStepperTableCell Example Usage Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of using HBStepperTableCell in a specifier plist. ```plist cellClass HBStepperTableCell default 5 defaults ws.hbang.common.demo key Stepper label %i Things max 15 min 1 singularLabel 1 Thing ``` -------------------------------- ### Initialize and Configure HBAppearanceSettings Source: https://hbang.github.io/libcephei/Classes/HBAppearanceSettings.html Example of initializing HBAppearanceSettings and setting various appearance properties like tint color, bar tint color, navigation bar title color, table view background color, and status bar style. ```objectivec - (instancetype)init { self = [super init]; if (self) { HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init]; appearanceSettings.tintColor = [UIColor colorWithRed:66.f / 255.f green:105.f / 255.f blue:154.f / 255.f alpha:1]; appearanceSettings.barTintColor = [UIColor systemRedColor]; appearanceSettings.navigationBarTitleColor = [UIColor whiteColor]; appearanceSettings.tableViewBackgroundColor = [UIColor colorWithWhite:242.f / 255.f alpha:1]; appearanceSettings.statusBarStyle = UIStatusBarStyleLightContent; self.hb_appearanceSettings = appearanceSettings; } return self; } ``` -------------------------------- ### Example: HBLinkTableCell with Icon Source: https://hbang.github.io/libcephei/Classes/HBLinkTableCell.html Configures an HBLinkTableCell to display a custom icon and open a URL. ```xml cellClass HBLinkTableCell icon example.png label Example url http://example.com/ ``` -------------------------------- ### HBPreferences Example (Swift) Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Illustrates setting up HBPreferences in Swift, including registering defaults, custom getters/setters, and KVO observation. Supports Key-Value Observation for preference changes. ```Swift class Preferences { private let preferences = HBPreferences(identifier: "ws.hbang.common.demo") // Example using registration method private(set) var canDoThing: ObjCBool = false // Example using custom getter and setter var anotherSetting: Int { get { preferences["AnotherSetting"] as? Int ?? -1 } set { preferences["AnotherSetting"] = newValue } } // Example using KVO observation private var doThingObserver: NSKeyValueObserving? init() { preferences.register(defaults: [ "Enabled": true, "AnotherSetting": 1 ]) preferences.register(&canDoThing, default: false, forKey: "DoThing") print("Am I enabled? \(preferences["Enabled"] as? Bool ?? false)") print("Can I do thing? \(canDoThing)") } } ``` -------------------------------- ### HBTintedTableCell Example Usage Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of using HBTintedTableCell in a specifier plist, with and without a custom tint color. ```plist cell PSButtonCell cellClass HBTintedTableCell label Do Something cell PSButtonCell cellClass HBTintedTableCell label Do Something tintColor #33b5e5 ``` -------------------------------- ### HBSpinnerTableCell Example Usage Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20Cells.html Example of using HBSpinnerTableCell in a specifier plist and its corresponding list controller implementation. ```plist action doStuffTapped: cell PSButtonCell cellClass HBSpinnerTableCell label Do Stuff ``` ```Objective-C - (void)doStuffTapped:(PSSpecifier *)specifier { PSTableCell *cell = [self cachedCellForSpecifier:specifier]; cell.cellEnabled = NO; // do something in the background… cell.cellEnabled = YES; } ``` -------------------------------- ### Example Usage of HBPreferences (Objective-C/Logos) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Demonstrates initializing HBPreferences, registering default values, and retrieving boolean preferences. This snippet is intended for use within Objective-C/Logos environments. ```objective-c HBPreferences *preferences; BOOL doThing; %ctor { preferences = [[HBPreferences alloc] initWithIdentifier:@"ws.hbang.common.demo"]; [preferences registerDefaults:@{ @"Enabled": @YES, @"AnotherSetting": @1.f }]; [preferences registerBool:&doThing default:NO forKey:@"DoThing"]; NSLog(@"Am I enabled? %i", [preferences boolForKey:@"Enabled"]); NSLog(@"Can I do thing? %i", doThing); } ``` -------------------------------- ### System Icon Parameters for Cells Source: https://hbang.github.io/libcephei/Classes/HBListController.html Examples demonstrating how to use SF Symbols for cell icons. Supports various configurations like different symbols, colors, and backgrounds. ```plist cell PSSwitchCell label Awesome iconImageSystem name switch.2 ``` ```plist cell PSLinkCell detail HBDemoAboutListController isController label ABOUT iconImageSystem name info.circle ``` ```plist cell PSSliderCell min 1 max 15 leftImageSystem name sun.min rightImageSystem name sun.max ``` ```plist cell PSButtonCell cellClass HBLinkTableCell label DONATE url https://hashbang.productions/ iconImageSystem name heart backgroundColor #ff3b30 ``` -------------------------------- ### HBPreferences Example (Objective-C/Logos) Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Demonstrates initializing HBPreferences, registering default values, and accessing boolean preferences. Ensure to read the discussion for -registerObject:default:forKey: before using the automatic updating mechanism. ```Objective-C HBPreferences *preferences; BOOL doThing; %ctor { preferences = [[HBPreferences alloc] initWithIdentifier:@"ws.hbang.common.demo"]; [preferences registerDefaults:@{ @"Enabled": @YES, @"AnotherSetting": @1.f }]; [preferences registerBool:&doThing default:NO forKey:@"DoThing"]; NSLog(@"Am I enabled? %i", [preferences boolForKey:@"Enabled"]); NSLog(@"Can I do thing? %i", doThing); } ``` -------------------------------- ### Example: HBLinkTableCell with Subtitle Source: https://hbang.github.io/libcephei/Classes/HBLinkTableCell.html Configures an HBLinkTableCell to display a label, subtitle, and open a URL. ```xml cellClass HBLinkTableCell label Example subtitle Visit our amazing website url http://example.com/ ``` -------------------------------- ### Example: HBLinkTableCell with Initials Source: https://hbang.github.io/libcephei/Classes/HBLinkTableCell.html Configures an HBLinkTableCell to display initials as the icon and open a URL. ```xml cellClass HBLinkTableCell initials XX label Example url http://example.com/ ``` -------------------------------- ### Example HBStepperTableCell Configuration in Plist Source: https://hbang.github.io/libcephei/Classes/HBStepperTableCell.html Demonstrates how to configure an HBStepperTableCell within a preferences plist file, including labels, range, and default value. ```xml cellClass HBStepperTableCell default 5 defaults ws.hbang.common.demo key Stepper label %i Things max 15 min 1 singularLabel 1 Thing ``` -------------------------------- ### PreferenceLoader Filter: Pre-iOS 12.0 Example Source: https://hbang.github.io/libcephei/Classes/HBListController.html Example of using pl_filter with CoreFoundationVersion to display a specifier on versions earlier than iOS 12.0. ```xml cell PSSwitchCell label My iOS <12 Only Feature pl_filter CoreFoundationVersion 0.0 1556.00 ``` -------------------------------- ### Execute Shell Command and Get Output (Swift) Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Executes a shell command and returns its output. Returns nil if the command fails. ```Swift func HBOutputForShellCommand(_ command: String) -> String? ``` -------------------------------- ### PreferenceLoader Filter: iOS 12.0+ Example Source: https://hbang.github.io/libcephei/Classes/HBListController.html Example of using pl_filter with CoreFoundationVersion to display a specifier only on iOS 12.0 or newer. ```xml cell PSSwitchCell label My iOS 12+ Only Feature pl_filter CoreFoundationVersion 1556.00 ``` -------------------------------- ### PreferenceLoader Filter: iOS 7.0 - 11.9 Example Source: https://hbang.github.io/libcephei/Classes/HBListController.html Example of using pl_filter with CoreFoundationVersion to display a specifier only between iOS 7.0 and 11.9. ```xml cell PSSwitchCell label My iOS 7-11 Only Feature pl_filter CoreFoundationVersion 847.20 1556.00 ``` -------------------------------- ### Execute Shell Command and Get Output (Objective-C) Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Executes a shell command and returns its output. Returns nil if the command fails. ```Objective-C extern NSString *_Nullable HBOutputForShellCommand(NSString *_Nonnull command) ``` -------------------------------- ### Get Dictionary Representation of Preferences (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns a dictionary containing all preferences that are currently set. Default values are not included. ```Swift func dictionaryRepresentation() -> [String : Any] ``` -------------------------------- ### Get Dictionary Representation of Preferences (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns a dictionary containing all preferences that are currently set. Default values are not included. ```Objective-C - (nonnull NSDictionary *)dictionaryRepresentation; ``` -------------------------------- ### Example: HBLinkTableCell with Subtitle in Big Mode Source: https://hbang.github.io/libcephei/Classes/HBLinkTableCell.html Configures an HBLinkTableCell for 'big mode' with a label, subtitle, and URL, specifying a custom height. ```xml big cellClass HBLinkTableCell height 64 label Example subtitle Visit our amazing website url http://example.com/ ``` -------------------------------- ### Get Preferences Identifier (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves the preferences identifier that was provided during initialization. ```Swift var identifier: String { get } ``` -------------------------------- ### Specify Cephei Dependency in Control File Source: https://hbang.github.io/libcephei/index.html Add 'ws.hbang.common' to the 'Depends:' list in your control file to ensure Cephei is installed on the device. Specify a minimum version to guarantee feature availability. ```text Depends: mobilesubstrate, something-else, some-other-package, ws.hbang.common (>= 1.17) ``` -------------------------------- ### Cell with System Icon (SF Symbols) Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20List%20Controllers.html Integrate SF Symbols into cells for enhanced visual representation. This example demonstrates using 'switch.2' symbol for a PSSwitchCell. ```plist cell PSSwitchCell label Awesome iconImageSystem name switch.2 ``` -------------------------------- ### HBAboutListController Specifier Example Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20List%20Controllers.html This dictionary defines specifiers for an HBAboutListController, including links to a website, an email support action, and a donation link. It uses PSLinkCell and PSGroupCell for structure and presentation. ```plist cell PSLinkCell cellClass HBLinkTableCell label Visit Website url https://hashbang.productions/ cell PSGroupCell label Experiencing issues? action hb_sendSupportEmail cell PSLinkCell label Email Support cell PSGroupCell footerText If you like this tweak, please consider a donation. cell PSLinkCell cellClass HBLinkTableCell label Donate url https://hashbang.productions/donate/ ``` -------------------------------- ### Access Preferences with Subscript (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Enables accessing preferences using subscript notation, similar to dictionary access. Allows getting and setting values. ```Swift let fooBar = preferences["FooBar"] as? String preferences["Awesome"] = true ``` -------------------------------- ### Access Preferences with Subscript (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Enables accessing preferences using subscript notation, similar to dictionary access. Allows getting and setting values. ```Objective-C NSString *fooBar = preferences[@"FooBar"]; preferences[@"Awesome"] = @YES; ``` -------------------------------- ### Get Float Preference (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a floating-point value for a given key. Returns the default if not set, or nil if no default is specified. ```Objective-C - (CGFloat)floatForKey:(nonnull NSString *)key; ``` -------------------------------- ### Getting Preference Values Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Methods to retrieve preference values associated with a given key. If no preference is set for the key, a provided default value is returned. ```APIDOC ## doubleForKey:default: ### Description Returns the double value associated with the specified key, or if no user preference is set, the provided default. ### Method Objective-C: `- (double)doubleForKey:(nonnull NSString *)key default:(double)defaultValue;` Swift: `func double(forKey key: String, default defaultValue: Double) -> Double` ### Parameters - **key** (NSString) - The key for which to return the corresponding value. - **defaultValue** (double) - The default value to use when no user preference is set. ### Return Value The double value associated with the specified key, or the default value. ## boolForKey:default: ### Description Returns the Boolean value associated with the specified key, or if no user preference is set, the provided default. ### Method Objective-C: `- (BOOL)boolForKey:(nonnull NSString *)key default:(BOOL)defaultValue;` Swift: `func bool(forKey key: String, default defaultValue: Bool) -> Bool` ### Parameters - **key** (NSString) - The key for which to return the corresponding value. - **defaultValue** (BOOL) - The default value to use when no user preference is set. ### Return Value The Boolean value associated with the specified key, or the default value. ``` -------------------------------- ### Get Integer Preference with Default (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an integer value for a given key, returning a provided default value if no preference is set. ```Objective-C - (NSInteger)integerForKey:(nonnull NSString *)key default:(NSInteger)defaultValue; ``` -------------------------------- ### Get Object for Key (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns the object associated with a key. If the preference is not set, it returns the default value; otherwise, it returns nil if no default is set. ```Swift func object(forKey key: String) -> Any ``` -------------------------------- ### Get Integer for Key (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns the integer value associated with a key. If the preference is not set, it returns the default. If no default is set, it returns nil. ```Objective-C - (NSInteger)integerForKey:(nonnull NSString *)key; ``` -------------------------------- ### Cephei defaults Command Line Usage Source: https://hbang.github.io/libcephei/defaults.html Provides a summary of the available commands and their syntax for the 'defaults' tool. Use this for general reference on how to interact with preferences. ```bash Usage: defaults read Show all preferences for id. defaults read Show value for preference key in id. defaults write Write value for preference key in id. defaults help Display this help. ``` -------------------------------- ### Get Object for Key (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns the object associated with a key. If the preference is not set, it returns the default value; otherwise, it returns nil if no default is set. Manual synchronization may be required on older iOS versions. ```Objective-C - (nonnull id)objectForKey:(nonnull NSString *)key; ``` -------------------------------- ### Initialize HBAppearanceSettings Source: https://hbang.github.io/libcephei/CepheiPrefs%20%E2%80%94%20General.html Use this snippet to set custom appearance settings for a view controller. It configures tint color, navigation bar, and table view background. ```objective-c - (instancetype)init { self = [super init]; if (self) { HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init]; appearanceSettings.tintColor = [UIColor colorWithRed:66.f / 255.f green:105.f / 255.f blue:154.f / 255.f alpha:1]; appearanceSettings.barTintColor = [UIColor systemRedColor]; appearanceSettings.navigationBarTitleColor = [UIColor whiteColor]; appearanceSettings.tableViewBackgroundColor = [UIColor colorWithWhite:242.f / 255.f alpha:1]; appearanceSettings.statusBarStyle = UIStatusBarStyleLightContent; self.hb_appearanceSettings = appearanceSettings; } return self; } ``` -------------------------------- ### Swift Method for Support View Controller Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Initializes a Mail composer using bundle and preferences identifier. Throws an exception if both are nil. Email is derived from the Author field, and package listing/preferences plist are attached. ```swift class func supportViewController(for bundle: Bundle?, preferencesIdentifier: String?) -> UIViewController ``` -------------------------------- ### Instantiate Multiple Constraints with Compact Syntax Source: https://hbang.github.io/libcephei/Categories/NSLayoutConstraint%28CompactConstraint%29.html Create multiple Auto Layout constraints using compact syntax, optionally mixing in Visual Format Language strings. Provide an array of relationship strings, metrics, views, and the self view. ```Objective-C + (NSArray *) hb_compactConstraints:(NSArray *)relationshipStrings metrics:(NSDictionary *)metrics views:(NSDictionary *)views self:(id)selfView; ``` ```Swift class func hb_compactConstraints(_ relationshipStrings: [String]!, metrics: [String : NSNumber]!, views: [String : UIView]!, self selfView: Any!) -> [NSLayoutConstraint]! ``` -------------------------------- ### Objective-C Method for Support View Controller Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Initializes a Mail composer using bundle and preferences identifier. Throws an exception if both are nil. Email is derived from the Author field, and package listing/preferences plist are attached. ```objective-c + (nonnull UIViewController *) supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier; ``` -------------------------------- ### Get Preferences Identifier (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves the preferences identifier that was provided during initialization. ```Objective-C @property (nonatomic, retain, readonly) NSString *_Nonnull identifier; ``` -------------------------------- ### Performing a System Respring Source: https://hbang.github.io/libcephei/Classes/HBListController.html Action specifier to initiate a system respring. It is generally recommended to prefer immediate preference application over using this method. ```objective-c - (void)hb_respring:(id)sender; ``` -------------------------------- ### Instantiate Single Constraint with Compact Syntax Source: https://hbang.github.io/libcephei/Categories/NSLayoutConstraint%28CompactConstraint%29.html Use this method to create a single Auto Layout constraint using the compact syntax. It requires a relationship string, metrics, views, and the self view. ```Objective-C + (instancetype)hb_compactConstraint:(NSString *)relationship metrics: (NSDictionary *)metrics views:(NSDictionary *)views self:(id)selfView; ``` ```Swift class func hb_compactConstraint(_ relationship: String!, metrics: [String : NSNumber]!, views: [String : UIView]!, self selfView: Any!) -> Self! ``` -------------------------------- ### supportViewControllerForBundle:preferencesIdentifier:linkInstruction:supportInstructions: Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Creates and returns a pre-configured email composer view controller for support. ```APIDOC ## supportViewControllerForBundle:preferencesIdentifier:linkInstruction:supportInstructions: ### Description Creates and returns a pre-configured email composer view controller for support purposes. This method is useful for providing users with a direct way to contact support with relevant package information. ### Method Objective-C: `+ (nonnull UIViewController *) supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier linkInstruction:(nullable id)linkInstruction supportInstructions:(nullable NSArray *)supportInstructions;` Swift: `class func supportViewController(for bundle: Bundle?, preferencesIdentifier: String?, linkInstruction: Any?, supportInstructions: [Any]?) -> UIViewController` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * `bundle` (NSBundle or Bundle) - Required - A bundle included with the package. * `preferencesIdentifier` (NSString or String) - Optional - The preferences identifier of the package, if it’s different from the package identifier that contains the bundle. * `linkInstruction` (id or Any) - Optional - Ignored. * `supportInstructions` (NSArray or [Any]) - Optional - Ignored. ### Response #### Success Response (200) A pre-configured email composer view controller. ``` -------------------------------- ### Preference Bundle Dictionary for HBDiscreteSliderTableCell Source: https://hbang.github.io/libcephei/Classes/HBDiscreteSliderTableCell.html Example usage within a preference bundle's dictionary to configure a discrete slider cell. ```xml cell PSSliderCell cellClass HBDiscreteSliderTableCell default 5 defaults ws.hbang.common.demo key Discrete label Discrete max 15 min 1 ``` -------------------------------- ### Swift Method for Support View Controller with Email Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Initializes a Mail composer with bundle, preferences identifier, and an optional email address. If sendToEmail is nil, the email is derived from the Author field. Package listing and preferences plist are attached. ```swift class func supportViewController(for bundle: Bundle?, preferencesIdentifier: String?, sendToEmail: String?) -> UIViewController ``` -------------------------------- ### Get Object Preference with Default (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an object associated with a key, returning a provided default value if no preference is set. ```Swift func object(forKey key: String, default defaultValue: Any?) -> Any ``` -------------------------------- ### Get Object Preference with Default (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an object associated with a key, returning a provided default value if no preference is set. ```Objective-C - (nonnull id)objectForKey:(nonnull NSString *)key default:(nullable id)defaultValue; ``` -------------------------------- ### Objective-C Method for Support View Controller with Email Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Initializes a Mail composer with bundle, preferences identifier, and an optional email address. If sendToEmail is nil, the email is derived from the Author field. Package listing and preferences plist are attached. ```objective-c + (nonnull UIViewController *) supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier sendToEmail:(nullable NSString *)sendToEmail; ``` -------------------------------- ### Get Boolean Preference (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a Boolean value for a given key. Returns the default if not set, or nil if no default is specified. ```Swift func bool(forKey key: String) -> Bool ``` -------------------------------- ### Add Constraints with Visual Format (Swift) Source: https://hbang.github.io/libcephei/Categories/UIView%28CompactConstraint%29.html A convenient Swift shortcut for adding constraints using the Visual Format Language. It accepts a format string, options, metrics, and a dictionary of views. ```Swift func hb_addConstraints(withVisualFormat format: String!, options opts: NSLayoutConstraint.FormatOptions = [], metrics: [String : NSNumber]!, views: [String : UIView]!) ``` -------------------------------- ### Get Boolean Preference (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a Boolean value for a given key. Returns the default if not set, or nil if no default is specified. ```Objective-C - (BOOL)boolForKey:(nonnull NSString *)key; ``` -------------------------------- ### Get Double Preference (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a double value for a given key. Returns the default if not set, or nil if no default is specified. ```Swift func double(forKey key: String) -> Double ``` -------------------------------- ### Initialize UIColor from Property List Value (Objective-C) Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Use this instance method to initialize a UIColor object with data from a property list value. Supported formats include RGB/RGBA arrays and CSS-style hex strings. ```Objective-C - (nonnull instancetype)hb_initWithPropertyListValue:(nonnull id)value; ``` -------------------------------- ### Get Double Preference (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a double value for a given key. Returns the default if not set, or nil if no default is specified. ```Objective-C - (double)doubleForKey:(nonnull NSString *)key; ``` -------------------------------- ### respringAndReturnTo: Source: https://hbang.github.io/libcephei/Classes/HBRespringController.html Restarts the system app and immediately launches a specified URL. This feature requires iOS 8.0 or newer; on older versions, a standard restart occurs without opening the URL. ```APIDOC ## respringAndReturnTo: (URL?) ### Description Restarts the system app and immediately launches a URL. Requires iOS 8.0 or newer. On older iOS versions, a standard restart occurs and the URL is not opened. ### Method Class Method ### Endpoint N/A (Class method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **returnURL** (URL?) - The URL to launch after restarting. ``` -------------------------------- ### Add Constraints with Visual Format (Objective-C) Source: https://hbang.github.io/libcephei/Categories/UIView%28CompactConstraint%29.html A convenient Objective-C shortcut for adding constraints using the Visual Format Language. It accepts a format string, options, metrics, and a dictionary of views. ```Objective-C - (void)hb_addConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics: (NSDictionary *) metrics views:(NSDictionary *) views; ``` -------------------------------- ### Get Float Preference (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a floating-point value for a given key. Returns the default if not set, or nil if no default is specified. ```Swift func float(forKey key: String) -> CGFloat ``` -------------------------------- ### Deprecated Swift Method for Support View Controller Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Deprecated method for initializing a Mail composer using only a bundle. Use +[HBSupportController supportViewControllerForBundle:preferencesIdentifier:] instead. TechSupport is no longer supported. ```swift class func supportViewController(for bundle: Bundle) -> UIViewController ``` -------------------------------- ### Deprecated Objective-C Method for Support View Controller with Extended Options Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Deprecated method for initializing a Mail composer with bundle, preferences identifier, custom link instruction, and support instructions. Use +[HBSupportController supportViewControllerForBundle:preferencesIdentifier:] instead. ```objective-c + (nonnull UIViewController *)supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier linkInstruction:(nullable id)linkInstruction supportInstructions:(nullable NSString *)supportInstructions; ``` -------------------------------- ### Initialize HBPreferences (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Initializes an instance of HBPreferences for a specified identifier. This is typically the same as the tweak's package identifier. ```Swift init(identifier: String) ``` -------------------------------- ### Get Float Preference with Default (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a floating-point value for a given key, returning a provided default value if no preference is set. ```Swift func float(forKey key: String, default defaultValue: CGFloat) -> CGFloat ``` -------------------------------- ### supportViewControllerForBundle:preferencesIdentifier: Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Initializes a Mail composer using information from a bundle and preferences identifier. Either a bundle or preferences identifier is required. The email address is derived from the package's control file, and user's package listing and preferences plist are attached. ```APIDOC ## supportViewControllerForBundle:preferencesIdentifier: ### Description Initializes a Mail composer by using information provided by a bundle and preferences identifier. Either a bundle or preferences identifier is required. The email address is derived from the `Author` field of the package’s control file. `HBSupportController` implicitly adds the user’s package listing (output of `dpkg -l`) and the preferences plist as attachments. ### Method Class Method ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift let supportVC = HBSupportController.supportViewController(for: bundle, preferencesIdentifier: "com.example.prefs") // Present supportVC modally ``` ### Response #### Success Response (200) A pre-configured email composer view controller. #### Response Example ```swift // UIViewController representing an email composer ``` ``` -------------------------------- ### Get Float Preference with Default (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves a floating-point value for a given key, returning a provided default value if no preference is set. ```Objective-C - (CGFloat)floatForKey:(nonnull NSString *)key default:(CGFloat)defaultValue; ``` -------------------------------- ### HBPreferences Initialization Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Creates an instance of the HBPreferences class for a specified identifier. This identifier is typically the same as the tweak's package identifier. ```APIDOC ## +preferencesForIdentifier: ### Description Creates an instance of the class for the specified identifier. ### Method `+ (nonnull instancetype)preferencesForIdentifier:(nonnull NSString *)identifier;` ### Parameters #### Path Parameters - **identifier** (NSString) - Required - The identifier to be used. This is usually the same as the package identifier of the tweak. ``` -------------------------------- ### Get Integer Preference with Default (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an integer value for a given key, returning a provided default value if no preference is set. ```Swift func integer(forKey key: String, default defaultValue: Int) -> Int ``` -------------------------------- ### Create Constraints with Visual Format and Identifier Source: https://hbang.github.io/libcephei/Categories/NSLayoutConstraint%28CompactConstraint%29.html A convenient shortcut to create Auto Layout constraints using a Visual Format string as the identifier. Specify the format string, options, metrics, and views. ```Objective-C + (NSArray *) hb_identifiedConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views; ``` ```Swift class func hb_identifiedConstraints(withVisualFormat format: String!, options opts: NSLayoutConstraint.FormatOptions = [], metrics: [String : NSNumber]!, views: [String : UIView]!) -> [NSLayoutConstraint]! ``` -------------------------------- ### Getting the Real Navigation Controller Source: https://hbang.github.io/libcephei/Classes/HBListController.html Retrieves the actual navigation controller responsible for the navigation bar, accounting for differences on larger iPhone models. ```objective-c - (nonnull UINavigationController *)realNavigationController; ``` -------------------------------- ### Deprecated Objective-C Method for Support View Controller Source: https://hbang.github.io/libcephei/Classes/HBSupportController.html Deprecated method for initializing a Mail composer using only a bundle. Use +[HBSupportController supportViewControllerForBundle:preferencesIdentifier:] instead. TechSupport is no longer supported. ```objective-c + (nonnull UIViewController *)supportViewControllerForBundle: (nonnull NSBundle *)bundle; ``` -------------------------------- ### Create Dark Interface Variant Color (Objective-C) Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Initializes a dynamic color object with saturation decreased by 4% for the dark interface style. If the color is already dynamic, it returns the receiver. ```Objective-C - (nonnull instancetype)hb_colorWithDarkInterfaceVariant; ``` -------------------------------- ### - hb_initWithPropertyListValue: Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Initializes a UIColor object using data from a property list value. Supported formats include RGB/RGBA arrays and CSS-style hex strings. ```APIDOC ## - hb_initWithPropertyListValue: ### Description Initializes and returns a color object using data from the specified object. The value is expected to be one of: * An array of 3 or 4 integer RGB or RGBA color components, with values between 0 and 255 (e.g. `@[ 218, 192, 222 ]`) * A CSS-style hex string, with an optional alpha component (e.g. `#DAC0DE` or `#DACODE55`) * A short CSS-style hex string, with an optional alpha component (e.g. `#DC0` or `#DC05`) ### Method `- (nonnull instancetype)hb_initWithPropertyListValue:(nonnull id)value;` ### Parameters - **value** (id) - The object to retrieve data from. See the discussion for the supported object types. ### Return Value An initialized color object. The color information represented by this object is in the device RGB colorspace. ``` -------------------------------- ### Get Integer for Key (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Returns the integer value associated with a key. If the preference is not set, it returns the default. If no default is set, it returns nil. ```Swift func integer(forKey key: String) -> Int ``` -------------------------------- ### Initialize HBPreferences (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Initializes an instance of HBPreferences for a specified identifier. This is typically the same as the tweak's package identifier. ```Objective-C - (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier; ``` -------------------------------- ### Initialize UIColor from Property List Value (Swift) Source: https://hbang.github.io/libcephei/Categories/UIColor%28HBAdditions%29.html Use this convenience initializer to create a UIColor object from a property list value. Supported formats include RGB/RGBA arrays and CSS-style hex strings. ```Swift convenience init(propertyListValue value: Any) ``` -------------------------------- ### Get Unsigned Integer Preference with Default (Swift) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an unsigned integer value for a given key, returning a provided default value if no preference is set. ```Swift func unsignedInteger(forKey key: String, default defaultValue: UInt) -> UInt ``` -------------------------------- ### Get Unsigned Integer Preference with Default (Objective-C) Source: https://hbang.github.io/libcephei/Classes/HBPreferences.html Retrieves an unsigned integer value for a given key, returning a provided default value if no preference is set. ```Objective-C - (NSUInteger)unsignedIntegerForKey:(nonnull NSString *)key default:(NSUInteger)defaultValue; ``` -------------------------------- ### Execute Shell Command with Return Code (Swift) Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Executes a shell command and returns its output along with the command's return code. ```Swift func HBOutputForShellCommandWithReturnCode(_ command: String, _ returnCode: UnsafeMutablePointer) -> String? ``` -------------------------------- ### HBOutputForShellCommandWithReturnCode Source: https://hbang.github.io/libcephei/Cephei%20%E2%80%94%20General.html Executes a shell command and returns its output along with the return code. ```APIDOC ## HBOutputForShellCommandWithReturnCode ### Description Executes a shell command and returns its output. ### Declaration Objective-C: ``` extern NSString *_Nullable HBOutputForShellCommandWithReturnCode( NSString *_Nonnull command, int *_Nonnull returnCode) ``` Swift: ``` func HBOutputForShellCommandWithReturnCode(_ command: String, _ returnCode: UnsafeMutablePointer) -> String? ``` ### Parameters - `_command_` (NSString/String) - The shell command to run. - `_returnCode_` (int*/UnsafeMutablePointer) - A pointer to an integer that will contain the return code of the command. ### Return Value The output of the provided command. ```