Skip to content

Commit

Permalink
- Refactor code to have stack views for better UI layout.
Browse files Browse the repository at this point in the history
- Set min OS version to iOS 11.0
- Add primary, secondary and footer labels to UI
- Add close button to UI
- Add more public properties for better control of what is happening
- Update ReadMe file
  • Loading branch information
BadhanGanesh committed Mar 14, 2020
1 parent a49b70f commit 67a91ab
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 160 deletions.
9 changes: 1 addition & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ import PackageDescription

let package = Package(
name: "BJOTPViewController",
platforms: [.iOS(.v9)],
platforms: [.iOS(.v11)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "BJOTPViewController",
targets: ["BJOTPViewController"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "BJOTPViewController",
dependencies:[]
Expand Down
66 changes: 57 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ This is intended to be a drag and drop view controller that gets the work done q

## Supports

✅ iOS 9.0+
✅ iOS 11.0+

✅ Swift 4.0+

✅ iOS | iPadOS

✅ Portrait | Landscape

✅ Light Mode | Dark Mode


## Features

✅ Keyboard handling

✅ Copy-Paste handling

✅ Light mode | Dark mode

✅ Apple-inspired Clean User Interface

✅ Custom primay / secondary / footer labels


## Installation

Expand Down Expand Up @@ -104,20 +106,66 @@ oneTimePasswordVC.currentTextFieldColor = UIColor.systemOrange
oneTimePasswordVC.authenticateButtonColor = UIColor.systemGreen
```

**Other options**

```swift
/**
* Setting this to true opens up the keyboard for the very first text field.
*
* Default is `false`. Consider the `hideLabelsWhenEditing` property when setting this one to `true`, because when the keyboard is open as soon as the view controller is presented/pushed, if `hideLabelsWhenEditing` is `true`, the labels will be hidden initially as a result, and the user won't even know that the labels exist. It will be a better user experience if the user sees the labels initially since it guides them what to do. Choose wisely.
*
* - Author: Badhan Ganesh
*/
@objc public var openKeyboadDuringStartup: Bool = false

/**
* The title of the primary header which stays above the OTP textfields.
*
* This is optional. In case of nil, the label won't be constructed at all. So make sure to set a string, or leave it as it is (`nil`). Changing this value after presenting or pushing `BJOTPViewController` won't have an effect; the label won't be constructed.
*
* - Author: Badhan Ganesh
*/
@objc public var primaryHeaderTitle: String?

/**
* The title of the secondary header which comes below the primary header.
*
* This is optional. In case of nil, the label won't be constructed at all. So make sure to set a string, or leave it as it is (`nil`). Changing this value after presenting or pushing `BJOTPViewController` won't have an effect; the label won't be constructed.
*
* - Author: Badhan Ganesh
*/
@objc public var secondaryHeaderTitle: String?

/**
* The title of the footer label which comes below the authenticate button.
*
* This is optional. In case of nil, the label won't be constructed at all. So make sure to set a string, or leave it as it is (`nil`). Changing this value after presenting or pushing `BJOTPViewController` won't have an effect; the label won't be constructed.
*
* - Author: Badhan Ganesh
*/
@objc public var footerTitle: String?

/**
* Set whether the primary, secondary, and footer labels are to be hidden during editing, i.e., when the keyboard is open.
*
* Default is `false`
*
* - Author: Badhan Ganesh
*/
@objc public var hideLabelsWhenEditing: Bool = false

```

## Upcoming Features

- Support for Mac Catalyst.
- Support for Mac Catalyst (Works, but will crash the app when copy-pasting text).
- Auto-completion of One Time Password into text fields from messages app.
- Addition of custom header text / footer text / description title to the view controller.
- Auto-completion of One Time Password from clipboard when copied from authenticator apps like **Google Authenticator**.
- Auto-completion of One Time Password from clipboard when copied from authenticator apps like **Google Authenticator** etc.


## Contribution

- Pull Requests are always welcome. 😇
- Feel free to create GitHub Issues when you face any problem, or for new feature-requests.
- Please follow [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) for raising PR's.
- Pull Requests are always welcome. Would love to see your inputs.

Thanks for checking out, and thanks for your contribution.

Expand Down
Loading

0 comments on commit 67a91ab

Please sign in to comment.