Last updated
Last updated
Modules built for Carbonite need to subclass UIView, each new module is added into an array of the ModulesView which the collection view uses to display those modules.
Modules must use AutoLayout to help them fit multiple screen sizes/window sizes. Using -initWithFrame: may result in issues and support will not be provided.
The @interface in the *.h file is where we can store any variables, properties or functions for use inside or outside the class. Properties and methods can be accessed outside the class while variables (places in curly brackets) cannot be seen and thus not be used by outside classes.
The @implementation in the *.m file is where the magic happens, this is where we code the majority of the class, starting with the -initWithFrame: method, if ever using .nib or .xib files (Xcode), you should also use -initWithCoder:
Carbonite uses the SBReachabilityWindow to add a property of ModulesView which holds all modules, CarboniteView which is the main module is added initially and any further modules are added after.
-layoutSubviews is never recommended when making tweaks. Carbonite is made in a way that it doesn't duplicate itself when a layout call is made.
Running this code as-is, with Carbonite installed will add it to the modules, this is your blank slate, add to it what you want and start coding an amazing module for use in an innovative tweak!
Weather Module
Maps Module
Calculator Module (suggested by a user on Reddit)
This page contains documentation on creating new module pages for Carbonite, modules follow a requirement to ensure they work well with each other and this page will show that.