Swiftpack.co - Package - StewartLynch/CTHelpSPM

CTHelp

License Platform

About CTHelp

CTHelp is a Help system for iOS/Swift 5.1+ and iOS13+

Beta2 Release for iOS13

CTHelp is fully light/Dark mode compatible.

SampleScreen

Installation

This version of CTHelp is installed via Swift Package Manager within XCode.

  1. From within Xcode 11 or later, choose File > Swift Package > Add Package Dependency

  2. At the next screen, enter https://github.com/StewartLynch/CTHelpSPM.git when asked to choose a Package Repository.

    packageURL

  3. Choose the latest version available (number may vary from this documentation)

    packageVersion

  4. Add the package to your target.

    target

You now have the dependency installed and are ready to import and use CTHelp

Quick Start

In your ViewController where you are going to present CTHelp,

import CTHelp

Add a button to your view and link the action to a function that sets up and presents the CTHelp view controller.

Here is a sample function that will create 3 help cards + 2 defaults (link to web and support email)

Note: No images appear until you upload images to your project and replace 'SomeFullSizedImage', 'SomeSmallImage' and 'CompanyLogo' with the corresponding names to your images.

Also, the links to the emailAddress and webSite will be broken until replaced with valid entries.

SampleCards

func showCTHelp() {
   let ctHelp = CTHelp()

   // Optional values to set colors - The defaults are as shown
   // **Note**: if you are going to replace colors with custom colors, make sure you use colors
   // that have both a light and dark appearance.  **Use the Asset Catalog**
   //
   // ctHelp.ctBgViewColor = .systemBackground
   // ctHelp.ctTitleColor = .label
   // ctHelp.ctHelpTextColor = .secondaryLabel
   // ctHelp.ctActionButtonBGColor = .systemBlue
   // ctHelp.ctActionButtonTextColor = .white
   // ctHelp.ctCloseButtonBGColor = .systemGray
   // ctHelp.ctCloseButtonTextColor = .white
   // ctHelp.ctPageControlColor = .label

   // Changes Color of buttons in navBar and on alertButtons when the mail form is presented
   // ctHelp.ctMailtintColor =  default tint color unless changed

   ctHelp.new(CTHelpItem(title:"No Text-Image Only",
                         helpText: "",
                         imageName:"SomeFullSizedImage"))
   ctHelp.new(CTHelpItem(title:"Text and Image",
                         helpText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                         imageName:"SomeSmallImage"))
   ctHelp.new(CTHelpItem(title:"No Image-Text Only",
                         helpText: "Eu tempor suscipit dis sed. Tortor velit orci bibendum mattis non metus ornare consequat. Condimentum habitasse dictumst eros nibh rhoncus non pulvinar fermentum. Maecenas convallis gravida facilisis. Interdum, conubia lacinia magnis duis nec quisque.Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                         imageName:""))

 // Optional addition of two default cards
 // Use only if you wish to change the strings presented in the two default cards
   // ctHelp.ctWebButtonTitle = ""
   // ctHelp.ctWebHelpText = ""
   // ctHelp.ctContactTitle = ""
   // ctHelp.ctContactHelpText = ""
   // ctHelp.ctIncludeDataText = ""
   // ctHelp.ctContactButtonTitle = ""

   // Email data
   // ctHelp.ctEmailSubject = ""
   // ctHelp.ctEmailAttachNote = ""
   // ctHelp.ctEmailBody = ""

   // Email alert
   // ctHelp.ctDataAlertTitle = ""
   // ctHelp.ctDataAlertMessage = ""
   // ctHelp.ctDataAlertActionNo = ""
   // ctHelp.ctDataAlertActionYes = ""

   ctHelp.appendDefaults(companyName: "Your Company Name", emailAddress: "yourContactEmail@somewhere.com", data: nil, webSite: "https://www.yourWebsite.com", companyImageName: "CompanyLogo")

   ctHelp.presentHelp(from: self)
}

Changing Colors

The optional color values let you change each of the 5 different components of the CTHelp Card.

By default, CTHelp supports light and dark mode by default and with the default color settings shown below. If you decide to override these colors with your own, it is recommended that you use the Asset Catalog and make sure that you create colors for both the Any and Dark modes.

CustomColor

So uncommenting and changing some or all of the values can change the appearance of your help card.

Optionals

Optional String Values

You may choose to override the strings that are used on the two default cards (web and email contact). For your reference, here is how they match up. If you do not change the strings, the text will appear as shown with the exception of your company and app name which are passed through with the function call.

webStrings

contactStrings

alertStrings

emailStrings

Feedback Requested:

Please provide me with feedback for improvement.

Author

StewartLynch, slynch@createchsol.com

License

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

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0