How to add toast message in your tweak

I found a project that can display a toast message in iOS which has the same functionality as Toast in Android

Download Toast project as zip scalessec/Toast

Extract Toast folder to your tweak

In your Makefile, Add UIView+Toast.m to [PROJECTNAME]_FILES

In your tweak.xm, Include UIView+Toast.h like

#include "Toast/UIView+Toast.h"

And add your UIView variable and hook view controller like UIViewController

UIView *uiView;

//Set our view variable
%hook UIViewController
  -(void)viewDidLoad {
    %orig;
    uiView = self.view;
  }
%end

If UIViewController doesn’t work, try other views.

Now you can use it like:

static void didFinishLaunching(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef info) {
  timer(2) {

    [uiView makeToast:@"Modded by AndnixSH\nPlatinmods.com - The gaming community"];
    load();
    });
}

void launchEvent() {
    CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), NULL, &didFinishLaunching, (CFStringRef)UIApplicationDidFinishLaunchingNotification, NULL, CFNotificationSuspensionBehaviorDrop);
}

__attribute__((constructor)) static void initialize() {
    launchEvent();
}

More example can be seen on Github. You may need to replace “self.view” with your UIView variable if you are using it within C++ side

Preview:

Image 2023 05 28 14 52 29.png

Popular Posts

[TOOL] Unity Assets Bundle Extractor

Il2CppDumper GUI Android App