- December 30, 2024
- Mins Read
During develop of my app Frind, I needed to manage in app notifications like whatsapp or telegram, but i didn’t find nothing that liked me, so, i created this library. Choose InAppNotify for your next project, I’ll be happy to give you a little help!
★★ Star our github repository to help us!, or ☕ pay me a coffee ★★
Created by Luca Becchetti
Here’s a highlight of the main features you can find in InAppNotify:
portrait
and landscape
orientationDo you like InAppNotify
? I’m also working on several other opensource libraries.
Take a look here:
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like InAppNotify in your projects. You can install it with the following command:
To integrate InAppNotify into your Xcode project using CocoaPods, specify it in your Podfile
:
Then, run the following command:
First of all import library in your project
The basic code to show a simple notification is:
This is a static method used to present a notitication, it takes two parameters, first is an instance of Announcement object, the second is a subclass of UIViewController
This library can show only an instance of “Announcement” object, you can pass many parameters to his initializer:
When object is created you can present it with this code:
When you create an announcement, you can interact with it passed an action callback:
From the callbacak you can access the announcement object that has been triggered this method, announcement has a particolar attribute called “userInfo” (it’s of type “Any”) that you can set when create object, and read here.
If you want to enable a textField interaction when pull down notification, pass this parameter to announcement object:
This will present a textArea where user can write! to modify the text button (“send” by default) use this code:
To read user input, if you have set an action callback, test if the type is “text” and access string variable:
InAppNotify supports themes, by default we have two themes, accessibile from “Themes” class:
To use a theme you have to set a global variable of the library, example:
Of course, you can create your custom theme programmatically, here an example: