Coder Social home page Coder Social logo

acknowlist's Introduction

AcknowList

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

Platform iOS Swift 5 Build Status Swift Package Manager CocoaPods compatible MIT license

Also available in Objective-C with VTAcknowledgementsViewController.

AcknowList 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 13 languages
  • UIKit and SwiftUI interfaces

Installation

CocoaPods

  1. Add pod 'AcknowList' to your Podfile.
  2. Run pod install.
  3. Add the Pods-#target#-acknowledgements.plist file generated by CocoaPods to your main target: drag and drop the file from the Pods/Target Support Files/Pods-#target#/ folder in your Xcode project (don’t copy the file, leave Copy items if needed unchecked).

Swift Package Manager

AcknowList can be installed with the Swift Package Manager (requires Xcode 12 for localized resources).

  1. Click on FileSwift PackagesAdd Package Dependency….
  2. Enter https://github.com/vtourraine/AcknowList.
  3. Select the version you’d like to use.

Initialization

The AcknowListViewController instance is usually pushed to an existing UINavigationController.

let viewController = AcknowListViewController()
navigationController.pushViewController(viewController, animated: true)

By default, the controller will try to guess the name of your .plist file, 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.

let viewController = AcknowListViewController(fileNamed: "Pods-AcknowExample-acknowledgements")
let path = Bundle.main.path(forResource: "Pods-AcknowExample-acknowledgements", ofType: "plist")
let viewController = AcknowListViewController(plistPath: path)

If you want to include licenses that are not part of a .plist file, you can create new Acknow instances, and use them for the acknowledgements array of the controller.

let acknow = Acknow(title: "...", text: "...")
let viewController = AcknowListViewController(acknowledgements: [acknow])

Customization

The controller can also display a header and a footer. By default, they are loaded from the generated plist file, but you can also directly change the properties values.

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.

button.setTitle(AcknowLocalization.localizedTitle(), for: .normal)

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

let viewController = AcknowListViewController(plistPath: path, style: .plain)

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

SwiftUI

AcknowList now offers a SwiftUI interface, which supports all the major platforms.

Instantiate a AcknowListSwiftUIView with a path to the plist file, or with an array of Acknow instances, and present this view from a NavigationView.

Platforms

Platform UIKit SwiftUI
📱 iOS 9.0+ iOS 13.0+
📺 tvOS 9.0+ tvOS 13.0+
⌚️ not supported watchOS 7.0+
💻 not supported macOS 10.15+

Requirements

AcknowList is written in Swift 5, and requires Xcode 12 and above.

Credits

AcknowList was created by Vincent Tourraine, and improved by a growing list of contributors.

License

AcknowList is available under the MIT license. See the LICENSE.txt file for more info.

acknowlist's People

Contributors

azhang66 avatar basthomas avatar danielriege avatar gerbiljames avatar honkmaster avatar idevelopper avatar jishidaaaaa avatar kieranharper avatar mattcroxson-csn avatar mortengregersen avatar naoty avatar oliverziegler avatar oscargorog avatar vtourraine avatar wooder avatar yoonhg84 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.