Tweaks are interesting because there are many, many things you can do. Having preference bundles is important for tweaks, as the user will be able to configure your tweak to their liking.
There is a universal way to make preference bundles for tweaks, although how you utilize them may be different. You could either make respringless preferences or ones that require a respring (easier to make).
- Open up your terminal and navigate to your tweak folder.
- Type in
$THEOS/bin/nic.pl
so we can make a subproject. - Choose
iphone/preference_bundle_modern
. - Choose the project name for your preference bundle, a good standard by which to name it would be
YourTweak
+Prefs
, so for example:ExampleTweakPrefs
. - Obviously choose your bundle ID,
com.yourcompany.exampletweakprefs
. - Same as in when we were setting up the tweak, enter your
Author/Maintainer Name
. - Next, you will see:
[iphone/preference_bundle_modern] Class name prefix (three or more characters unique to this project) [XXX]
.- What is this? It is basically the unique prefix for your "classes," so for example, let's say you have a UIViewController and you want it's name to be unique so that when you press the tweak name in the settings app, your tweak shows up.
- Let's say you choose the class name prefix to be
EXM
, your Root List Controller would be calledEXMRootListController.m
. It is important that this is unique to your tweak.
.
├── EXMRootListController.h
├── EXMRootListController.m
├── Makefile
├── Resources
│ ├── Info.plist
│ └── Root.plist
└── layout
└── Library
└── PreferenceLoader
└── Preferences
└── ExampleTweakPrefs.plist
This is the file tree of the preference bundle, let's look at each file closely.
EXMRootListController.h
- This is the headers file, we technically don't need it, although it's useful to clean up our code. It is where all the interfaces, imports, and variables are placed.
EXMRootListController.m
- This is our view controller file, it is the thing that helps display the
Root.plist
when the tweak page is opened in the settings app.
- This is our view controller file, it is the thing that helps display the
Makefile
- This makefile performs the same function as the makefile in the tweak project.
Resources
folder- This folder is where all the assets and
.plist
s are placed, it will be used a lot.
- This folder is where all the assets and
Info.plist
- This is the file that holds all the "technical" stuff, you will likely not touch it.
Root.plist
- This is an important file, it holds the cells that are displayed when you open the tweak page.
ExampleTweakPrefs.plist
- This is also a file that holds "technical" stuff, you will likely not touch it either.