Dev:CSPageViewController

From The Apple Wiki

CSPageViewController is a class representing a page on the lockscreen. You should not directly create an instance of it; subclass it instead.

As of iOS 15.2.1, two subclasses of CSPageViewController are present:

  1. CSTodayPageViewController (displays widgets)
  2. SBDashBoardCameraPageViewController (provides access to the camera)

Creating a New Page

%subclass MyPageViewController : CSPageViewController

// Override methods here as needed.

%end

Adding Your New Page

After creating your page subclass you can add it to the lockscreen by hooking:

-(id)initWithPageViewControllers:(id)arg0 mainPageContentViewController:(id)arg1 context:(id)arg2 ;

within CSCoverSheetViewController. Simply append a new instance of your subclass into arg1 - note that you will need a mutable copy of it.

%hook CSCoverSheetViewController
-(id)initWithPageViewControllers:(id)arg0 mainPageContentViewController:(id)arg1 context:(id)arg2 {
  NSMutableArray *pages = [arg0 mutableCopy];
  
  MyPageViewController *newPage = [[%c(MyPageViewController) alloc] init];
  
  [pages insertObject:newPage atIndex:1];

  return %orig(pages, arg1, arg2);
}
%end

References