Introduce HReminder Framework

joker hook
3 min readJul 8, 2019

Photo by Dawid Zawiła on Unsplash

General

HReminder is a Cocoa Touch framework and manages button displayed at the top of the screen. It is especially well suited as a small tag to remind users about something.

It has an interface similar to the button displayed by Medium which Medium app uses this button to reminder reader to ‘Start from beginning’. It now supports both the iPhone and the iPad.

Here are some screenshots showing what you can build with HReminder.

And it also supports all device orientations.

Here are some screenshots showing how it looks like on iPad.

Requirements

  • Xcode 11 and later
  • iOS 13 and later
  • Swift 5.0 and later

Installation

You can only clone this framework and add it to your project🤪

Usage

It’s very simple to use this framework, just a few steps. First, you need to add this line at the top of your file:

import HReminder

The Basics

HReminder displays a Button called reminderButton, specially it is not a Label. This framework provides a standard type called HReminderViewController. I have provided several interfaces that allow you to modify the color of the button and the title of the button. You can also choose your actions after clicking the button.

Displaying Button

To display this button you first need to create a HReminderViewController.

var reminder = HReminderViewController()

To present your button, call this method:

self.reminder.showInView(superview: self.view)

If you want to hide this button, call this method:

self.reminder.hideInView()

There is also an another way to hide this button by calling ReminderViewClose().(I will explain later)

Change Title and Color

You can simply change the title and color of the button by calling these two methods:

self.reminder.setTitle(Reminder: "Start from beginning")
self.reminder.setReminderBackgroundColor(color: .systemGreen)

Handling Button Taps

If you want to play some actions after tapping the button you can simply add HReminderViewControllerDelegate to your project. Set HReminderViewControllerDelegate to be your superclass.

And then add codes to your viewDidLoad() :

reminder.delegate = self

Now I provide a method for you to handle button taps. You can write your actions in ReminderViewClose(), simply like:

func ReminderViewClose() {
let alertController = UIAlertController(title: "Attention", message: "You have tapped the button", preferredStyle: .alert)
let cancleAction = UIAlertAction(title: "Cancle", style: .cancel, handler: nil)
alertController.addAction(cancleAction)
present(alertController, animated: true, completion: nil)
}

Last but not least

I will add more features to this framework.🤗 You can find it here.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

joker hook
joker hook

Written by joker hook

👨‍🎓/study communication engineering🛠/love iOS development💻/🐶🌤🍽🏸🏫

No responses yet

Write a response