UI Customization
Theming
The visual appearance of Buglife views & view controllers can be configured via the Buglife.apperance
property, which returns an object conforming to the LIFEAppearance
protocol.
Example:
/// Swift
let appearance = Buglife.shared().appearance
appearance.tintColor = .purple
appearance.barTintColor = .white
appearance.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.purple]
appearance.statusBarStyle = .default
/// Objective-C
id<LIFEAppearance> appearance = [[Buglife sharedBuglife] appearance];
appearance.tintColor = [UIColor purpleColor];
appearance.barTintColor = [UIColor whiteColor];
appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : [UIColor blackColor] };
appearance.statusBarStyle = UIStatusBarStyleDefault;
Strings
Strings shown in the Buglife reporter UI can be customized using your application’s Localizable.strings
. Buglife-specific localizable string keys can be found in Buglife+LocalizableStrings.h
(view on GitHub).
Example: You may wish to present Buglife as a feedback
reporter, rather than a bug
reporter. To do so, add localized strings for the LIFEStringKey_ReportABug
and LIFEStringKey_ThanksForFilingABug
keys to your string resource file(s), as such:
// Localizable.strings
// MyApp
// <Other localized strings for your application>
"LIFEStringKey_ReportABug" = "Report Feedback";
"LIFEStringKey_ThanksForFilingABug" = "Thanks for submitting feedback!";
Bug reporter prompt
When a user triggers a valid invocation method (such as shaking their device), the user is presented with a prompt to confirm intention. The default prompt contains a title to provide context for the user.
You may choose to customize the title displayed in this prompt, or remove the title entirely. To do so, you’ll need to
Adopt the
BuglifeDelegate
protocol, and set Buglife’s delegate property.Implement
buglife:titleForPromptWithInvocation:
in your application code.
We recommend using your AppDelegate, for example:
/// Swift 3
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, BuglifeDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Buglife.shared().start(withAPIKey: "<YOUR_API_KEY>")
Buglife.shared().delegate = self
return true
}
func buglife(_ buglife: Buglife, titleForPromptWithInvocation invocation: LIFEInvocationOptions = []) -> String? {
return "We love bug reports! 🤘"
}
}
/// Objective-C
@interface AppDelegate () <BuglifeDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[Buglife sharedBuglife] startWithAPIKey:@"<YOUR_API_KEY>"];
[Buglife sharedBuglife].delegate = self;
return YES;
}
- (NSString *)buglife:(Buglife *)buglife titleForPromptWithInvocation:(LIFEInvocationOptions)invocation {
return @"We love bug reports! 🤘";
}
@end