Home

Awesome

Overview

DCOAboutWindow is a replacement for the standard About dialog.

It adds the option to open acknowledgments and visit the website by clicking a button.

DCOAboutWindow in action DCOAboutWindow in Dark Mode

Showing acknowledgments

You can point to and maintain a custom Acknowledgments.rtf file, or you can use a script like Acknowledge to generate it for you.

Setup

Via cocoapods

Add the following line to your Podfile:

pod 'DCOAboutWindow'

Then run pod install and you're set.

Via Carthage

Add the following to your Cartfile:

github "DangerCove/DCOAboutWindow"
github "DangerCove/DCOTransparentScroller"

Then run carthage update and you're set.

Manually

Clone this repo and add files from DCOAboutWindow to your project.

The project relies on DCOTransparentScroller, so include that too.

Usage

I've made a sample project that accompanies this tiny guide.

Import DCOAboutWindowController:

#import <DCOAboutWindow/DCOAboutWindowController.h>

Instantiate DCOAboutWindow:

// Note: make sure self.aboutWindowController is retained
self.aboutWindowController = [[DCOAboutWindowController alloc] init];

Create an IBAction to display the window:

- (IBAction)showAboutWindow:(id)sender {
  [self.aboutWindowController showWindow:nil];
}

Hook it up to the 'About [app name]' menu item or a button.

You can change values by setting properties on DCOAboutWindowController:

/**
 *  The application name.
 *  Default: CFBundleName
 */
@property (copy) NSString *appName;

/**
 *  The application version.
 *  Default: "Version %@ (Build %@)", CFBundleVersion, CFBundleShortVersionString
 */
@property (copy) NSString *appVersion;

/**
 *  The copyright line.
 *  Default: NSHumanReadableCopyright
 */
@property (copy) NSString *appCopyright;

/**
 *  The credits.
 *  Default: [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
 */
@property (copy) NSAttributedString *appCredits;

/**
 *  The URL pointing to the app's website.
 *  Default: none
 */
@property (strong) NSURL *appWebsiteURL;

/**
 *  The path to the file that contains the acknowledgments.
 *  Default: [[NSBundle mainBundle] pathForResource:@"Acknowledgments" ofType:@"rtf"];
 */
@property (nonatomic, copy) NSString *acknowledgmentsPath;

/**
 *  If set to YES acknowledgments are shown in a text view, inside the window. Otherwise an external editor is launched.
 *  Default: NO;
 */
@property (assign) BOOL useTextViewForAcknowledgments;

Pre-processing (for Dark Mode)

You can pre-process the NSAttributedString containing the app credits using a delegate. This is great for making the about window play nice with Mojave's Dark Mode. Here's how it works:

// Conform to the DCOStringPreprocessingProtocol
@interface DCDAppDelegate() <DCOStringPreprocessingProtocol>

self.aboutWindowController = [[DCOAboutWindowController alloc] init];
// Set the delegate
self.aboutWindowController.delegate = self;

#pragma mark - DCOStringPreprocessingProtocol

- (NSAttributedString *)preprocessAppCredits:(NSAttributedString *)appCredits {
    NSMutableAttributedString *mutableCredits = [appCredits mutableCopy];
    
    NSDictionary *attributes = @{ NSForegroundColorAttributeName : [NSColor textColor] };
    [mutableCredits addAttributes:attributes range:NSMakeRange(0, mutableCredits.length)];
    
    return [mutableCredits copy];
}

// Optionally pre-process the acknowledgments as well
- (NSAttributedString *)preprocessAppAcknowledgments:(NSAttributedString *)appAcknowledgments {
    NSMutableAttributedString *mutableAcknowledgments = [appAcknowledgments mutableCopy];
    
    NSDictionary *attributes = @{ NSForegroundColorAttributeName : [NSColor textColor] };
    [mutableAcknowledgments addAttributes:attributes range:NSMakeRange(0, mutableCredits.length)];
    
    return [mutableAcknowledgments copy];
}

Thanks to @balthisar for adding this.

Localization

Add the following lines to your Localizable.string to change these values, or localize them.

/* Version %@ (Build %@), displayed in the about window */
"Version %@ (Build %@)" = "v%@ (%@)";

/* Caption on the 'Visit the %@ Website' button in the about window */
"Visit the %@ Website" = "Visit %@'s Website";

/* Caption of the 'Acknowledgments' button in the about window */
"Acknowledgments" = "Acknowledgments";

/* Caption of the 'Credits' button in the about window when acknowledgments are shown when useTextViewForAcknowledgments is YES. */
"Credits" = "Credits";

Contributions and things to add

Be creative. DCOAboutWindow should be a flexible, easy to use way to make the About Window for your app look pretty. Make sure your changes don't break existing functionality without good reason.

To create a pull request:

Spin-offs

Let me know if you made far going modifications by including your project in this section. Add yourself to the list and send me a pull request.

Add-ons

Related apps, tools and scripts that extend DCOAboutWindow's functionality.

Changelog

v0.4.0

v0.3.1

v0.3.0

v0.2.0

Set useTextViewForAcknowledgments to YES to enable this feature.

v0.1.0

You can toggle (off by default) resizing by setting the NSWindow's styleMask. Check out the example project to see how this works.

v0.0.2

v0.0.1

License

New BSD License, see LICENSE for details.