Home iOS Tweak Development : 1
Post
Cancel

iOS Tweak Development : 1

Note

This series of posts is not made as strictly a tutorial. While I will be explaining how things work and giving instruction on iOS tweak development, the purpose of this posting is to explain and document my journey/path of learning to develop iOS tweaks. If you desire for strictly a tutorial in iOS Tweak Development check out these links here : Zane Helton or r/Jailbreak Tutorial

What are iOS Tweaks?

iOS Tweaks are used by Jailbroken iOS users to modify parts of the system or applications. These modifications can be for anything from customization to adding functionality. These tweaks are installed and managed from a package manager such as Cydia or Zebra.

What language are tweaks written in?

The language that the majority iOS tweaks are written in is Logos. However Logos is technically a pre-processor for Objective-C. This means that Logos is used to hook into the original compiled code from iOS and from there use Objective-C like calls in order to modify or make changes to the processes.

Getting Started : The First Steps

So as I have been jailbreaking for many years I have had some interest in tweak development before. This allowed me to have already done what I consider to be a crucial first few steps. These step(s) being simply researching and getting any knowledge I can about X topic. I do this so that I am at least semi-familiar with some parts of the topic. The goal is not to become an expert, but instead to become less overwhelmed by the lack of knowledge. One source of information I went to was the Jailbreak Developer Subreddit, here I just browsed some questions and got myself familiar with some of the different aspects to iOS Tweak Development.

Getting Started : Finding Tools

One thing I learned from my time researching iOS tweak development is that there are a number of different tools that have been developed to help assist tweak devs. I am not going to give tutorials here on installation as it may look different depending upon your circumstances. The first and most important tool is Theos. Theos is a suite of tools that consists of a handful of important components such as:

1
2
3
    - A project templating system (NIC), which creates ready-to-build empty projects for varying purposes
    - A robust build system driven by GNU Make, capable of directly creating .deb packages for distribution in Cydia
    - Logos, a built-in preprocessor-based library of directives designed to make MobileSubstrate extension development easy

For my basic purposes currently, Theos is where I go to create a template for each of my tweak projects.

The next tool I found is called FLEXing. This tool is an opensource tool that allows you to view and modify the inner workings of your iOS applications or System. Essentially the way you can view it is similar to Inspect Element or developer tools from web browsers, being that you can debug and modify the current running application. This functionality is priceless when it comes to tweak development because the alternative is to look through iOS Headers and attempting to make sense of each method and class of the specific framework I’m interested in do.

Getting Started : Installing my first “personal” tweak

For my first tweak I just wanted to ensure that I had everything working properly, and that I understood the steps of compiling then installing a tweak. A bit of a ‘Hello World’ if you will. So I copied an example tweak I found into a Theos generated template with default settings and ran the very handy Makefile generated by Theos. This tweak was rather simple it simply draws a red rectangle on the lockscreen :


@interface SBLockScreenViewControllerBase : UIViewController
@end

%hook SBLockScreenViewControllerBase
- (void)viewDidLoad {
	%orig;

	// our code
	UIVisualEffectView *redRectangle = [[UIVisualEffectView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
	[redRectangle setBackgroundColor:[UIColor redColor]];
	[self.view addSubview:redRectangle];
}
%end

Success

And just like that I had successfully installed my first tweak from my MacBook! But now I had to understand what actually made it do that.

Thank you!

I hope you found this both informative and entertaining. In the next post I will be sharing what I have learned about developing my own iOS Tweaks from scratch. View the next post here.

This post is licensed under CC BY 4.0 by the author.