Skip to content

Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.

License

Notifications You must be signed in to change notification settings

vtourraine/VTAcknowledgementsViewController

Repository files navigation

VTAcknowledgementsViewController

Acknowledgements screen displaying a list of licenses, for example fromCocoaPodsdependencies.

Platform iOS Build & Test CocoaPods compatible MIT license

Also available in Swift withAcknowList.

VTAcknowledgementsViewController screenshots

Features

  • Automatically load acknowledgments from CocoaPods-generated file
  • Remove unnecessary line breaks from licenses for better text wrapping
  • Optional list header and footer
  • Tappable links in header, footer, and acknowledgment text
  • Storyboard support
  • Dark Mode support
  • Dynamic Type support
  • Localized in 12 languages

Installation

CocoaPods is the most common solution to install this library.

  1. Addpod 'VTAcknowledgementsViewController'to yourPodfile.
  2. Runpod install.
  3. Add thePods-#target#-acknowledgements.plistfile generated by CocoaPods to your main target: drag and drop the file from thePods/Target Support Files/Pods-#target#/folder in your Xcode project (don’t copy the file, leaveCopy items if neededunchecked).

Initialization

TheVTAcknowledgementsViewControllerinstance is usually pushed to an existingUINavigationController.

VTAcknowledgementsViewController *viewController = [VTAcknowledgementsViewControlleracknowledgementsViewController];
[self.navigationControllerpushViewController:viewControlleranimated:YES];

By default, the controller will try to guess the name of your.plistfile, based on the bundle name (Pods-#bundle-name#-acknowledgements.plist). If that doesn’t match the file you’re looking for, you can initialize the view controller with a custom file name or path.

viewController = [[VTAcknowledgementsViewControlleralloc]initWithFileNamed:@ "Pods-MyTarget-acknowledgements"];
NSString*path = [[NSBundlemainBundle]pathForResource:@ "Pods-MyTarget-acknowledgements"ofType:@ "plist"];
viewController = [[VTAcknowledgementsViewControlleralloc]initWithPath:path];

If you want to include licenses that are not part of aplistfile, you can easily create newVTAcknowledgementinstances, and use them for the acknowledgements array of the controller.

VTAcknowledgement *customLicense = [[VTAcknowledgementalloc]initWithTitle:@ "..."text:@ "..."license:nil];
viewController = [[VTAcknowledgementsViewControlleralloc]initWithAcknowledgements:@[customLicense]];

Customization

The controller can also display a header and a footer. By default, they are loaded from the generatedplistfile, but you can also directly change the properties values. If these texts contain a link, the view is tappable, and opens a browser with the URL.

viewController.headerText =@ "We love open source software.";
viewController.footerText =@ "Powered by CocoaPods.org";

The controller title is a localized value for “acknowledgements”. You might want to use this localized value for the button presenting the controller.

NSString*localizedTitle = [VTLocalizationlocalizedTitle];
[buttonsetTitle:localizedTitleforState:UIControlStateNormal];

By default,VTAcknowledgementsViewControlleruses the “grouped” table view style. You can choose a different style:

viewController = [[VTAcknowledgementsViewControlleralloc]initWithAcknowledgements:@[]style:UITableViewStylePlain];

If you need to further customize the appearance or behavior of this library, feel free to subclass its classes.

Apple TV

VTAcknowledgementsViewController is also compatible with tvOS for Apple TV apps.

VTAcknowledgementsViewController Apple TV screenshots

Requirements

VTAcknowledgementsViewController supports iOS 9.0 or tvOS 9.0 and above, and requires Xcode 11.0 and above. If you need lower requirements, look for anolder version of this repository.

Credits

VTAcknowledgementsViewController was created byVincent Tourraine,and improved by a growinglist of contributors.

License

VTAcknowledgementsViewController is available under the MIT license. See theLICENSE.mdfile for more info.