Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8367342b25 | |||
| 2df073a792 | |||
| 8236fc97cc | |||
| 0364de36bd | |||
| 12195eb879 | |||
| acdc46c43f | |||
| 52eed1b6f9 | |||
| a91d1de9ad | |||
| 492d2e49fe | |||
| 49bc439000 | |||
| 8c919cc26c |
@@ -214,14 +214,6 @@ CGFloat const kFLEXDebounceForExpensiveIO = 0.5;
|
||||
self.didInitiallyRevealSearchBar = NO;
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
if (self.searchController.active) {
|
||||
self.searchController.active = NO;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)debounce:(void(^)(void))block {
|
||||
|
||||
@@ -131,11 +131,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
|
||||
NSString *viewControllerSelectorString = [@[@"_vie", @"wContro", @"llerFor", @"Supported", @"Interface", @"Orientations"] componentsJoinedByString:@""];
|
||||
SEL viewControllerSelector = NSSelectorFromString(viewControllerSelectorString);
|
||||
if ([viewController respondsToSelector:viewControllerSelector]) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
viewController = [viewController performSelector:viewControllerSelector];
|
||||
#pragma clang diagnostic pop
|
||||
viewController = [viewController valueForKey:viewControllerSelectorString];
|
||||
}
|
||||
|
||||
return viewController;
|
||||
}
|
||||
|
||||
@@ -148,7 +146,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
|
||||
}
|
||||
|
||||
// The UIViewController docs state that this method must not return zero.
|
||||
// If we weren't able to get a valid value for the supported interface orientations, default to all supported.
|
||||
// If we weren't able to get a valid value for the supported interface
|
||||
// orientations, default to all supported.
|
||||
if (supportedOrientations == 0) {
|
||||
supportedOrientations = UIInterfaceOrientationMaskAll;
|
||||
}
|
||||
@@ -794,7 +793,14 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
|
||||
// the UITextEffectsWindow has a lower level than the FLEX window by default
|
||||
// until a text field is activated, bringing it above the FLEX window.
|
||||
if (@available(iOS 13, *)) {
|
||||
UIApplication.sharedApplication.windows[1].windowLevel = self.view.window.windowLevel + 1;
|
||||
for (UIWindow *window in UIApplication.sharedApplication.windows) {
|
||||
if ([window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")]) {
|
||||
if (window.windowLevel <= self.view.window.windowLevel) {
|
||||
window.windowLevel = self.view.window.windowLevel + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move the status bar on top of FLEX so we can get scroll to top behavior for taps.
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
||||
@interface FLEXClassesTableViewController : FLEXTableViewController <FLEXGlobalsEntry>
|
||||
|
||||
@property (nonatomic, copy) NSString *binaryImageName;
|
||||
+ (instancetype)binaryImageName:(NSString *)binaryImageName;
|
||||
|
||||
@end
|
||||
|
||||
@@ -14,33 +14,56 @@
|
||||
|
||||
@interface FLEXClassesTableViewController ()
|
||||
|
||||
@property (nonatomic) NSArray<NSString *> *classNames;
|
||||
@property (nonatomic) NSArray<NSString *> *filteredClassNames;
|
||||
@property (nonatomic, copy) NSArray<NSString *> *classNames;
|
||||
@property (nonatomic, copy) NSArray<NSString *> *filteredClassNames;
|
||||
@property (nonatomic, copy) NSString *binaryImageName;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FLEXClassesTableViewController
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
+ (instancetype)binaryImageName:(NSString *)binaryImageName
|
||||
{
|
||||
return [[self alloc] initWithBinaryImageName:binaryImageName];
|
||||
}
|
||||
|
||||
- (id)initWithBinaryImageName:(NSString *)binaryImageName
|
||||
{
|
||||
NSParameterAssert(binaryImageName);
|
||||
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.binaryImageName = binaryImageName;
|
||||
[self loadClassNames];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
self.showsSearchBar = YES;
|
||||
[self updateTitle];
|
||||
}
|
||||
|
||||
- (void)setBinaryImageName:(NSString *)binaryImageName
|
||||
- (void)updateTitle
|
||||
{
|
||||
if (![_binaryImageName isEqual:binaryImageName]) {
|
||||
_binaryImageName = binaryImageName;
|
||||
[self loadClassNames];
|
||||
[self updateTitle];
|
||||
}
|
||||
NSString *shortImageName = self.binaryImageName.lastPathComponent;
|
||||
self.title = [NSString stringWithFormat:@"%@ Classes (%lu)",
|
||||
shortImageName, (unsigned long)self.filteredClassNames.count
|
||||
];
|
||||
}
|
||||
|
||||
- (void)setClassNames:(NSArray<NSString *> *)classNames
|
||||
{
|
||||
_classNames = classNames;
|
||||
self.filteredClassNames = classNames;
|
||||
_classNames = self.filteredClassNames = classNames.copy;
|
||||
}
|
||||
|
||||
- (void)loadClassNames
|
||||
@@ -61,12 +84,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateTitle
|
||||
{
|
||||
NSString *shortImageName = self.binaryImageName.lastPathComponent;
|
||||
self.title = [NSString stringWithFormat:@"%@ Classes (%lu)", shortImageName, (unsigned long)self.filteredClassNames.count];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - FLEXGlobalsEntry
|
||||
|
||||
@@ -75,10 +92,7 @@
|
||||
}
|
||||
|
||||
+ (UIViewController *)globalsEntryViewController:(FLEXGlobalsRow)row {
|
||||
FLEXClassesTableViewController *classesViewController = [self new];
|
||||
classesViewController.binaryImageName = [FLEXUtility applicationImageName];
|
||||
|
||||
return classesViewController;
|
||||
return [self binaryImageName:[FLEXUtility applicationImageName]];
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +102,7 @@
|
||||
{
|
||||
if (searchText.length > 0) {
|
||||
NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[cd] %@", searchText];
|
||||
self.filteredClassNames = [self.classNames filteredArrayUsingPredicate:searchPredicate];
|
||||
self.filteredClassNames = [self.classNames filteredArrayUsingPredicate:searchPredicate].reverseObjectEnumerator.allObjects;
|
||||
} else {
|
||||
self.filteredClassNames = self.classNames;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "FLEXLibrariesTableViewController.h"
|
||||
#import "FLEXUtility.h"
|
||||
#import "FLEXClassesTableViewController.h"
|
||||
#import "FLEXClassExplorerViewController.h"
|
||||
#import "FLEXObjectExplorerFactory.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@interface FLEXLibrariesTableViewController ()
|
||||
@@ -186,13 +186,13 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.row == 0 && self.foundClass) {
|
||||
FLEXClassExplorerViewController *objectExplorer = [FLEXClassExplorerViewController new];
|
||||
objectExplorer.object = self.foundClass;
|
||||
[self.navigationController pushViewController:objectExplorer animated:YES];
|
||||
[self.navigationController pushViewController:[FLEXObjectExplorerFactory
|
||||
explorerViewControllerForObject:self.foundClass
|
||||
] animated:YES];
|
||||
} else {
|
||||
FLEXClassesTableViewController *classesViewController = [FLEXClassesTableViewController new];
|
||||
classesViewController.binaryImageName = self.filteredImageNames[self.foundClass ? indexPath.row-1 : indexPath.row];
|
||||
[self.navigationController pushViewController:classesViewController animated:YES];
|
||||
[self.navigationController pushViewController:[FLEXClassesTableViewController
|
||||
binaryImageName:self.filteredImageNames[self.foundClass ? 0 : indexPath.row]
|
||||
] animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ static const NSInteger kFLEXLiveObjectsSortBySizeIndex = 2;
|
||||
- (UITableViewCell *)tableView:(__kindof UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *cell = [tableView
|
||||
dequeueReusableCellWithIdentifier:[tableView defaultReuseIdentifier]
|
||||
dequeueReusableCellWithIdentifier:kFLEXDefaultCell
|
||||
forIndexPath:indexPath
|
||||
];
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
@interface FLEXFileBrowserTableViewController : FLEXTableViewController <FLEXGlobalsEntry>
|
||||
|
||||
+ (instancetype)path:(NSString *)path;
|
||||
- (id)initWithPath:(NSString *)path;
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
|
||||
@implementation FLEXFileBrowserTableViewController
|
||||
|
||||
+ (instancetype)path:(NSString *)path
|
||||
{
|
||||
return [[self alloc] initWithPath:path];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
return [self initWithPath:NSHomeDirectory()];
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#import "FLEXMultilineTableViewCell.h"
|
||||
#import "FLEXUtility.h"
|
||||
#import "FLEXManager+Private.h"
|
||||
#import "FLEXTableView.h"
|
||||
|
||||
typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
|
||||
|
||||
@@ -65,7 +66,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.tableView registerClass:[FLEXMultilineTableViewCell class] forCellReuseIdentifier:kFLEXMultilineTableViewCellIdentifier];
|
||||
[self.tableView registerClass:[FLEXMultilineTableViewCell class] forCellReuseIdentifier:kFLEXMultilineCell];
|
||||
}
|
||||
|
||||
- (void)setTransaction:(FLEXNetworkTransaction *)transaction
|
||||
@@ -147,7 +148,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
FLEXMultilineTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLEXMultilineTableViewCellIdentifier forIndexPath:indexPath];
|
||||
FLEXMultilineTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLEXMultilineCell forIndexPath:indexPath];
|
||||
|
||||
FLEXNetworkDetailRow *rowModel = [self rowModelAtIndexPath:indexPath];
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
//
|
||||
// FLEXClassTreeViewController.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 7/17/19.
|
||||
// Copyright © 2019 Flipboard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FLEXClassTreeViewController : UIPageViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// FLEXClassTreeViewController.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 7/17/19.
|
||||
// Copyright © 2019 Flipboard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXClassTreeViewController.h"
|
||||
|
||||
@interface FLEXClassTreeViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation FLEXClassTreeViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -6,6 +6,10 @@
|
||||
// Copyright (c) 2014 Flipboard. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _FLEXObjectExplorerViewController_h
|
||||
#define _FLEXObjectExplorerViewController_h
|
||||
#endif
|
||||
|
||||
#import "FLEXTableViewController.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FLEXObjectExplorerSection) {
|
||||
|
||||
@@ -810,7 +810,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
|
||||
|
||||
BOOL isCustomSection = explorerSection == FLEXObjectExplorerSectionCustom;
|
||||
BOOL useDescriptionCell = explorerSection == FLEXObjectExplorerSectionDescription;
|
||||
NSString *cellIdentifier = useDescriptionCell ? kFLEXMultilineTableViewCellIdentifier : @"cell";
|
||||
NSString *cellIdentifier = useDescriptionCell ? kFLEXMultilineCell : @"cell";
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
||||
if (!cell) {
|
||||
if (useDescriptionCell) {
|
||||
|
||||
@@ -168,6 +168,7 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
|
||||
#define PropertyKeyGetter(getter) kFLEXUtilityAttributeCustomGetter : NSStringFromSelector(@selector(getter))
|
||||
#define PropertyKeySetter(setter) kFLEXUtilityAttributeCustomSetter : NSStringFromSelector(@selector(setter))
|
||||
|
||||
/// Takes: min iOS version, property name, target class, property type, and a list of attributes
|
||||
#define FLEXRuntimeUtilityTryAddProperty(iOS_atLeast, name, cls, type, ...) ({ \
|
||||
if (@available(iOS iOS_atLeast, *)) { \
|
||||
NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithDictionary:@{ \
|
||||
@@ -181,8 +182,11 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
|
||||
]; \
|
||||
} \
|
||||
})
|
||||
|
||||
/// Takes: min iOS version, property name, target class, property type, and a list of attributes
|
||||
#define FLEXRuntimeUtilityTryAddNonatomicProperty(iOS_atLeast, name, cls, type, ...) \
|
||||
FLEXRuntimeUtilityTryAddProperty(iOS_atLeast, name, cls, @encode(type), PropertyKey(NonAtomic), __VA_ARGS__);
|
||||
/// Takes: min iOS version, property name, target class, property type (class name), and a list of attributes
|
||||
#define FLEXRuntimeUtilityTryAddObjectProperty(iOS_atLeast, name, cls, type, ...) \
|
||||
FLEXRuntimeUtilityTryAddProperty(iOS_atLeast, name, cls, FLEXEncodeClass(type), PropertyKey(NonAtomic), __VA_ARGS__);
|
||||
|
||||
@@ -195,7 +199,7 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
|
||||
// This way, we can use our property editor to access and change them.
|
||||
// The property attributes match the declared attributes in their headers.
|
||||
|
||||
// UIView
|
||||
// UIView, public
|
||||
FLEXRuntimeUtilityTryAddNonatomicProperty(2, frame, UIView, CGRect);
|
||||
FLEXRuntimeUtilityTryAddNonatomicProperty(2, alpha, UIView, CGFloat);
|
||||
FLEXRuntimeUtilityTryAddNonatomicProperty(2, clipsToBounds, UIView, BOOL);
|
||||
@@ -203,6 +207,8 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
|
||||
FLEXRuntimeUtilityTryAddNonatomicProperty(2, hidden, UIView, BOOL, PropertyKeyGetter(isHidden));
|
||||
FLEXRuntimeUtilityTryAddObjectProperty(2, backgroundColor, UIView, UIColor, PropertyKey(Copy));
|
||||
FLEXRuntimeUtilityTryAddObjectProperty(6, constraints, UIView, NSArray, PropertyKey(ReadOnly));
|
||||
FLEXRuntimeUtilityTryAddObjectProperty(2, subviews, UIView, NSArray, PropertyKey(ReadOnly));
|
||||
FLEXRuntimeUtilityTryAddObjectProperty(2, superview, UIView, UIView, PropertyKey(ReadOnly));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
#import "FLEXGlobalsEntry.h"
|
||||
|
||||
#ifndef _FLEXObjectExplorerViewController_h
|
||||
#import "FLEXObjectExplorerViewController.h"
|
||||
#else
|
||||
@class FLEXObjectExplorerViewController;
|
||||
#endif
|
||||
|
||||
@interface FLEXObjectExplorerFactory : NSObject <FLEXGlobalsEntry>
|
||||
|
||||
|
||||
@@ -8,10 +8,14 @@
|
||||
|
||||
#import "FLEXTableViewCell.h"
|
||||
|
||||
extern NSString *const kFLEXMultilineTableViewCellIdentifier;
|
||||
|
||||
/// A cell with both labels set to be multi-line capable.
|
||||
@interface FLEXMultilineTableViewCell : FLEXTableViewCell
|
||||
|
||||
+ (CGFloat)preferredHeightWithAttributedText:(NSAttributedString *)attributedText inTableViewWidth:(CGFloat)tableViewWidth style:(UITableViewStyle)style showsAccessory:(BOOL)showsAccessory;
|
||||
|
||||
@end
|
||||
|
||||
/// A \c FLEXMultilineTableViewCell initialized with \c UITableViewCellStyleSubtitle
|
||||
@interface FLEXMultilineDetailTableViewCell : FLEXMultilineTableViewCell
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#import "FLEXMultilineTableViewCell.h"
|
||||
|
||||
NSString *const kFLEXMultilineTableViewCellIdentifier = @"kFLEXMultilineTableViewCellIdentifier";
|
||||
|
||||
@implementation FLEXMultilineTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
@@ -17,6 +15,7 @@ NSString *const kFLEXMultilineTableViewCellIdentifier = @"kFLEXMultilineTableVie
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
self.textLabel.numberOfLines = 0;
|
||||
self.detailTextLabel.numberOfLines = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -53,3 +52,12 @@ NSString *const kFLEXMultilineTableViewCellIdentifier = @"kFLEXMultilineTableVie
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FLEXMultilineDetailTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
return [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// A cell initialized with \c UITableViewCellStyleSubtitle
|
||||
@interface FLEXSubtitleTableViewCell : UITableViewCell
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -8,12 +8,32 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#pragma mark Reuse identifiers
|
||||
|
||||
typedef NSString * FLEXTableViewCellReuseIdentifier;
|
||||
|
||||
/// A regular \c UITableViewCell initialized with \c UITableViewCellStyleDefault
|
||||
extern FLEXTableViewCellReuseIdentifier const kFLEXDefaultCell;
|
||||
/// A \c FLEXSubtitleTableViewCell initialized with \c UITableViewCellStyleSubtitle
|
||||
extern FLEXTableViewCellReuseIdentifier const kFLEXDetailCell;
|
||||
/// A \c FLEXMultilineTableViewCell initialized with \c UITableViewCellStyleDefault
|
||||
extern FLEXTableViewCellReuseIdentifier const kFLEXMultilineCell;
|
||||
/// A \c FLEXMultilineTableViewCell initialized with \c UITableViewCellStyleSubtitle
|
||||
extern FLEXTableViewCellReuseIdentifier const kFLEXMultilineDetailCell;
|
||||
|
||||
#pragma mark - FLEXTableView
|
||||
@interface FLEXTableView : UITableView
|
||||
|
||||
+ (instancetype)flexDefaultTableView;
|
||||
+ (instancetype)groupedTableView;
|
||||
+ (instancetype)plainTableView;
|
||||
|
||||
@property (nonatomic, readonly) NSString *defaultReuseIdentifier;
|
||||
@property (nonatomic, readonly) NSString *subtitleReuseIdentifier;
|
||||
@property (nonatomic, readonly) NSString *multilineReuseIdentifier;
|
||||
/// You do not need to register classes for any of the default reuse identifiers above
|
||||
/// (annotated as \c FLEXTableViewCellReuseIdentifier types) unless you wish to provide
|
||||
/// a custom cell for any of those reuse identifiers. By default, \c FLEXTableViewCell,
|
||||
/// \c FLEXSubtitleTableViewCell, and \c FLEXMultilineTableViewCell are used, respectively.
|
||||
///
|
||||
/// @param registrationMapping A map of reuse identifiers to \c UITableViewCell (sub)class objects.
|
||||
- (void)registerCells:(NSDictionary<NSString *, Class> *)registrationMapping;
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,6 +11,13 @@
|
||||
#import "FLEXSubtitleTableViewCell.h"
|
||||
#import "FLEXMultilineTableViewCell.h"
|
||||
|
||||
FLEXTableViewCellReuseIdentifier const kFLEXDefaultCell = @"kFLEXDefaultCell";
|
||||
FLEXTableViewCellReuseIdentifier const kFLEXDetailCell = @"kFLEXDetailCell";
|
||||
FLEXTableViewCellReuseIdentifier const kFLEXMultilineCell = @"kFLEXMultilineCell";
|
||||
FLEXTableViewCellReuseIdentifier const kFLEXMultilineDetailCell = @"kFLEXMultilineDetailCell";
|
||||
|
||||
#pragma mark Private
|
||||
|
||||
@interface UITableView (Private)
|
||||
- (CGFloat)_heightForHeaderInSection:(NSInteger)section;
|
||||
- (NSString *)_titleForHeaderInSection:(NSInteger)section;
|
||||
@@ -44,40 +51,44 @@
|
||||
return height;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
|
||||
{
|
||||
#pragma mark - Initialization
|
||||
|
||||
+ (id)groupedTableView {
|
||||
#if FLEX_AT_LEAST_IOS13_SDK
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [[self alloc] initWithFrame:CGRectZero style:UITableViewStyleInsetGrouped];
|
||||
} else {
|
||||
return [[self alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
}
|
||||
#else
|
||||
return [[self alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (id)plainTableView {
|
||||
return [[self alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
|
||||
self = [super initWithFrame:frame style:style];
|
||||
if (self) {
|
||||
[self registerCells:@{
|
||||
self.defaultReuseIdentifier : [FLEXTableViewCell class],
|
||||
self.subtitleReuseIdentifier : [FLEXSubtitleTableViewCell class],
|
||||
self.multilineReuseIdentifier : [FLEXMultilineTableViewCell class],
|
||||
kFLEXDefaultCell : [FLEXTableViewCell class],
|
||||
kFLEXDetailCell : [FLEXSubtitleTableViewCell class],
|
||||
kFLEXMultilineCell : [FLEXMultilineTableViewCell class],
|
||||
kFLEXMultilineDetailCell : [FLEXMultilineDetailTableViewCell class]
|
||||
}];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)registerCells:(NSDictionary<NSString*,Class> *)registrationMapping
|
||||
{
|
||||
#pragma mark - Public
|
||||
|
||||
- (void)registerCells:(NSDictionary<NSString*, Class> *)registrationMapping {
|
||||
[registrationMapping enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, Class cellClass, BOOL *stop) {
|
||||
[self registerClass:cellClass forCellReuseIdentifier:identifier];
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSString *)defaultReuseIdentifier
|
||||
{
|
||||
return @"kFLEXTableViewCellIdentifier";
|
||||
}
|
||||
|
||||
- (NSString *)subtitleReuseIdentifier
|
||||
{
|
||||
return @"kFLEXSubtitleTableViewCellIdentifier";
|
||||
}
|
||||
|
||||
- (NSString *)multilineReuseIdentifier
|
||||
{
|
||||
return kFLEXMultilineTableViewCellIdentifier;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// NSArray+Functional.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 9/25/19.
|
||||
// Copyright © 2019 Flipboard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSArray<T> (Functional)
|
||||
|
||||
/// Actually more like flatmap, but it seems like the objc way to allow returning nil to omit objects.
|
||||
/// So, return nil from the block to omit objects, and return an object to include it in the new array.
|
||||
- (NSArray *)flex_mapped:(id(^)(T obj, NSUInteger idx))mapFunc;
|
||||
- (NSArray<T> *)flex_filtered:(BOOL(^)(T obj, NSUInteger idx))filterFunc;
|
||||
- (void)flex_forEach:(id(^)(T obj, NSUInteger idx))block;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// NSArray+Functional.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 9/25/19.
|
||||
// Copyright © 2019 Flipboard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSArray+Functional.h"
|
||||
|
||||
@implementation NSArray (Functional)
|
||||
|
||||
- (instancetype)flex_mapped:(id (^)(id, NSUInteger))mapFunc {
|
||||
NSMutableArray *map = [NSMutableArray new];
|
||||
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
id ret = mapFunc(obj, idx);
|
||||
if (ret) {
|
||||
[map addObject:ret];
|
||||
}
|
||||
}];
|
||||
|
||||
return map.copy;
|
||||
}
|
||||
|
||||
- (NSArray *)flex_filtered:(BOOL (^)(id, NSUInteger))filterFunc {
|
||||
return [self flex_mapped:^id(id obj, NSUInteger idx) {
|
||||
return filterFunc(obj, idx) ? obj : nil;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)flex_forEach:(id (^)(id, NSUInteger))block {
|
||||
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
block(obj, idx);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -65,6 +65,11 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
|
||||
// we check to see if the pointer is of a valid object. If not,
|
||||
// we just display the NSValue.
|
||||
if (!returnsObjectOrClass) {
|
||||
// Skip NSNumber instances
|
||||
if ([returnedObjectOrNil isKindOfClass:[NSNumber class]]) {
|
||||
return returnedObjectOrNil;
|
||||
}
|
||||
|
||||
// Can only be NSValue since return type is not an object,
|
||||
// so we bail if this doesn't add up
|
||||
if (![returnedObjectOrNil isKindOfClass:[NSValue class]]) {
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#define FLEX_AT_LEAST_IOS13_SDK NO
|
||||
#endif
|
||||
|
||||
#define FLEXPluralString(count, plural, singular) [NSString \
|
||||
stringWithFormat:@"%@ %@", @(count), (count == 1 ? singular : plural) \
|
||||
]
|
||||
|
||||
@interface FLEXUtility : NSObject
|
||||
|
||||
+ (UIColor *)consistentRandomColorForObject:(id)object;
|
||||
|
||||
@@ -48,28 +48,22 @@
|
||||
|
||||
+ (UIViewController *)viewControllerForView:(UIView *)view
|
||||
{
|
||||
UIViewController *viewController = nil;
|
||||
SEL viewDelSel = NSSelectorFromString(@"_viewDelegate");
|
||||
if ([view respondsToSelector:viewDelSel]) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
viewController = [view performSelector:viewDelSel];
|
||||
#pragma clang diagnostic pop
|
||||
NSString *viewDelegate = @"viewDelegate";
|
||||
if ([view respondsToSelector:NSSelectorFromString(viewDelegate)]) {
|
||||
return [view valueForKey:viewDelegate];
|
||||
}
|
||||
return viewController;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (UIViewController *)viewControllerForAncestralView:(UIView *)view
|
||||
{
|
||||
UIViewController *viewController = nil;
|
||||
SEL viewDelSel = NSSelectorFromString([NSString stringWithFormat:@"%@ewControllerForAncestor", @"_vi"]);
|
||||
if ([view respondsToSelector:viewDelSel]) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
viewController = [view performSelector:viewDelSel];
|
||||
#pragma clang diagnostic pop
|
||||
NSString *_viewControllerForAncestor = @"_viewControllerForAncestor";
|
||||
if ([view respondsToSelector:NSSelectorFromString(_viewControllerForAncestor)]) {
|
||||
return [view valueForKey:_viewControllerForAncestor];
|
||||
}
|
||||
return viewController;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSString *)detailDescriptionForView:(UIView *)view
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
@interface FLEXImagePreviewViewController : UIViewController
|
||||
|
||||
+ (instancetype)forImage:(UIImage *)image;
|
||||
- (id)initWithImage:(UIImage *)image;
|
||||
|
||||
@end
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
|
||||
@implementation FLEXImagePreviewViewController
|
||||
|
||||
+ (instancetype)forImage:(UIImage *)image
|
||||
{
|
||||
return [[self alloc] initWithImage:image];
|
||||
}
|
||||
|
||||
- (id)initWithImage:(UIImage *)image
|
||||
{
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = "FLEX"
|
||||
spec.version = "3.1.1"
|
||||
spec.version = "3.1.2"
|
||||
spec.summary = "A set of in-app debugging and exploration tools for iOS"
|
||||
spec.description = <<-DESC
|
||||
- Inspect and modify views in the hierarchy.
|
||||
|
||||
@@ -182,8 +182,6 @@
|
||||
C37A0C94218BAC9600848CA7 /* FLEXObjcInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = C37A0C92218BAC9600848CA7 /* FLEXObjcInternal.mm */; };
|
||||
C387C87A22DFCD6A00750E58 /* FLEXCarouselCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C387C87822DFCD6A00750E58 /* FLEXCarouselCell.h */; };
|
||||
C387C87B22DFCD6A00750E58 /* FLEXCarouselCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C387C87922DFCD6A00750E58 /* FLEXCarouselCell.m */; };
|
||||
C387C87E22DFD71A00750E58 /* FLEXClassTreeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C387C87C22DFD71A00750E58 /* FLEXClassTreeViewController.h */; };
|
||||
C387C87F22DFD71A00750E58 /* FLEXClassTreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C387C87D22DFD71A00750E58 /* FLEXClassTreeViewController.m */; };
|
||||
C387C88322E0D24A00750E58 /* UIView+FLEX_Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = C387C88122E0D24A00750E58 /* UIView+FLEX_Layout.h */; };
|
||||
C387C88422E0D24A00750E58 /* UIView+FLEX_Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = C387C88222E0D24A00750E58 /* UIView+FLEX_Layout.m */; };
|
||||
C38DF0EA22CFE4370077B4AD /* FLEXTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C38DF0E822CFE4370077B4AD /* FLEXTableViewController.h */; };
|
||||
@@ -196,6 +194,8 @@
|
||||
C39ED92922D63F3200B5773A /* FLEXAddressExplorerCoordinator.m in Sources */ = {isa = PBXBuildFile; fileRef = C39ED92722D63F3200B5773A /* FLEXAddressExplorerCoordinator.m */; };
|
||||
C3DA55FE21A76406005DDA60 /* FLEXMutableFieldEditorViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C3DA55FC21A76406005DDA60 /* FLEXMutableFieldEditorViewController.h */; };
|
||||
C3DA55FF21A76406005DDA60 /* FLEXMutableFieldEditorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA55FD21A76406005DDA60 /* FLEXMutableFieldEditorViewController.m */; };
|
||||
C3BFD070233C23ED0015FB82 /* NSArray+Functional.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BFD06E233C23ED0015FB82 /* NSArray+Functional.h */; };
|
||||
C3BFD071233C23ED0015FB82 /* NSArray+Functional.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BFD06F233C23ED0015FB82 /* NSArray+Functional.m */; };
|
||||
C3DB9F642107FC9600B46809 /* FLEXObjectRef.h in Headers */ = {isa = PBXBuildFile; fileRef = C3DB9F622107FC9600B46809 /* FLEXObjectRef.h */; };
|
||||
C3DB9F652107FC9600B46809 /* FLEXObjectRef.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DB9F632107FC9600B46809 /* FLEXObjectRef.m */; };
|
||||
C3DC287C223ED5F200F48AA6 /* FLEXOSLogController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34EE30721CB23CC00BD3A7C /* FLEXOSLogController.m */; };
|
||||
@@ -405,8 +405,6 @@
|
||||
C37A0C92218BAC9600848CA7 /* FLEXObjcInternal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FLEXObjcInternal.mm; sourceTree = "<group>"; };
|
||||
C387C87822DFCD6A00750E58 /* FLEXCarouselCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXCarouselCell.h; sourceTree = "<group>"; };
|
||||
C387C87922DFCD6A00750E58 /* FLEXCarouselCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLEXCarouselCell.m; sourceTree = "<group>"; };
|
||||
C387C87C22DFD71A00750E58 /* FLEXClassTreeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXClassTreeViewController.h; sourceTree = "<group>"; };
|
||||
C387C87D22DFD71A00750E58 /* FLEXClassTreeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLEXClassTreeViewController.m; sourceTree = "<group>"; };
|
||||
C387C88122E0D24A00750E58 /* UIView+FLEX_Layout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+FLEX_Layout.h"; sourceTree = "<group>"; };
|
||||
C387C88222E0D24A00750E58 /* UIView+FLEX_Layout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+FLEX_Layout.m"; sourceTree = "<group>"; };
|
||||
C38DF0E822CFE4370077B4AD /* FLEXTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXTableViewController.h; sourceTree = "<group>"; };
|
||||
@@ -419,6 +417,8 @@
|
||||
C39ED92722D63F3200B5773A /* FLEXAddressExplorerCoordinator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLEXAddressExplorerCoordinator.m; sourceTree = "<group>"; };
|
||||
C3DA55FC21A76406005DDA60 /* FLEXMutableFieldEditorViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXMutableFieldEditorViewController.h; sourceTree = "<group>"; };
|
||||
C3DA55FD21A76406005DDA60 /* FLEXMutableFieldEditorViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLEXMutableFieldEditorViewController.m; sourceTree = "<group>"; };
|
||||
C3BFD06E233C23ED0015FB82 /* NSArray+Functional.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+Functional.h"; sourceTree = "<group>"; };
|
||||
C3BFD06F233C23ED0015FB82 /* NSArray+Functional.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Functional.m"; sourceTree = "<group>"; };
|
||||
C3DB9F622107FC9600B46809 /* FLEXObjectRef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXObjectRef.h; sourceTree = "<group>"; };
|
||||
C3DB9F632107FC9600B46809 /* FLEXObjectRef.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLEXObjectRef.m; sourceTree = "<group>"; };
|
||||
C3EE76BD22DFC63600EC0AA0 /* FLEXScopeCarousel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FLEXScopeCarousel.h; sourceTree = "<group>"; };
|
||||
@@ -805,6 +805,8 @@
|
||||
C387C88222E0D24A00750E58 /* UIView+FLEX_Layout.m */,
|
||||
C3F646BF239EAA8F00D4A011 /* UIPasteboard+FLEX.h */,
|
||||
C3F646C0239EAA8F00D4A011 /* UIPasteboard+FLEX.m */,
|
||||
C3BFD06E233C23ED0015FB82 /* NSArray+Functional.h */,
|
||||
C3BFD06F233C23ED0015FB82 /* NSArray+Functional.m */,
|
||||
);
|
||||
path = Categories;
|
||||
sourceTree = "<group>";
|
||||
@@ -844,8 +846,6 @@
|
||||
children = (
|
||||
3A4C944C1B5B21410088C3F2 /* FLEXObjectExplorerViewController.h */,
|
||||
3A4C944D1B5B21410088C3F2 /* FLEXObjectExplorerViewController.m */,
|
||||
C387C87C22DFD71A00750E58 /* FLEXClassTreeViewController.h */,
|
||||
C387C87D22DFD71A00750E58 /* FLEXClassTreeViewController.m */,
|
||||
3A4C943C1B5B21410088C3F2 /* FLEXArrayExplorerViewController.h */,
|
||||
3A4C943D1B5B21410088C3F2 /* FLEXArrayExplorerViewController.m */,
|
||||
3A4C943E1B5B21410088C3F2 /* FLEXClassExplorerViewController.h */,
|
||||
@@ -917,9 +917,9 @@
|
||||
3A4C950F1B5B21410088C3F2 /* FLEXMethodCallingViewController.h in Headers */,
|
||||
3A4C94F51B5B21410088C3F2 /* FLEXArgumentInputObjectView.h in Headers */,
|
||||
3A4C94F11B5B21410088C3F2 /* FLEXArgumentInputFontsPickerView.h in Headers */,
|
||||
C3BFD070233C23ED0015FB82 /* NSArray+Functional.h in Headers */,
|
||||
779B1ED61C0C4D7C001F5E49 /* FLEXTableContentViewController.h in Headers */,
|
||||
3A4C94C91B5B21410088C3F2 /* FLEXDefaultsExplorerViewController.h in Headers */,
|
||||
C387C87E22DFD71A00750E58 /* FLEXClassTreeViewController.h in Headers */,
|
||||
3A4C95221B5B21410088C3F2 /* FLEXFileBrowserSearchOperation.h in Headers */,
|
||||
C33E46AF223B02CD004BD0E6 /* FLEXASLLogController.h in Headers */,
|
||||
C34EE30821CB23CC00BD3A7C /* FLEXOSLogController.h in Headers */,
|
||||
@@ -1096,7 +1096,6 @@
|
||||
224D49A91C673AB5000EAB86 /* FLEXRealmDatabaseManager.m in Sources */,
|
||||
C39ED92922D63F3200B5773A /* FLEXAddressExplorerCoordinator.m in Sources */,
|
||||
2EF6B04D1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m in Sources */,
|
||||
C387C87F22DFD71A00750E58 /* FLEXClassTreeViewController.m in Sources */,
|
||||
94A515201C4CA1F10063292F /* FLEXWindow.m in Sources */,
|
||||
3A4C95121B5B21410088C3F2 /* FLEXPropertyEditorViewController.m in Sources */,
|
||||
3A4C95391B5B21410088C3F2 /* FLEXNetworkRecorder.m in Sources */,
|
||||
@@ -1107,6 +1106,7 @@
|
||||
3A4C94F61B5B21410088C3F2 /* FLEXArgumentInputObjectView.m in Sources */,
|
||||
3A4C94EC1B5B21410088C3F2 /* FLEXImagePreviewViewController.m in Sources */,
|
||||
3A4C94F21B5B21410088C3F2 /* FLEXArgumentInputFontsPickerView.m in Sources */,
|
||||
C3BFD071233C23ED0015FB82 /* NSArray+Functional.m in Sources */,
|
||||
7349FD6B22B93CDF00051810 /* FLEXColor.m in Sources */,
|
||||
94AAF0391BAF2E1F00DE8760 /* FLEXKeyboardHelpViewController.m in Sources */,
|
||||
3A4C951F1B5B21410088C3F2 /* FLEXClassesTableViewController.m in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user