Skip to content

Commit c75e4c9

Browse files
committed
Shortcuts (mostly) done
1 parent 7d32953 commit c75e4c9

18 files changed

+168
-138
lines changed

Classes/Editing/FLEXFieldEditorViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ + (instancetype)target:(id)target property:(FLEXProperty *)property {
3838
}
3939

4040
FLEXFieldEditorViewController *editor = [self target:target];
41-
editor.title = [@"Property: " stringByAppendingString:property.name];
41+
editor.title = [@"Property: " stringByAppendingString:property.name.string];
4242
editor.property = property;
4343
return editor;
4444
}
4545

4646
+ (instancetype)target:(id)target ivar:(nonnull FLEXIvar *)ivar {
4747
FLEXFieldEditorViewController *editor = [self target:target];
48-
editor.title = [@"Ivar: " stringByAppendingString:ivar.name];
48+
editor.title = [@"Ivar: " stringByAppendingString:ivar.name.string];
4949
editor.ivar = ivar;
5050
return editor;
5151
}

Classes/Editing/FLEXMethodCallingViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ - (void)viewDidLoad {
4747

4848
// Configure field editor view
4949
self.fieldEditorView.argumentInputViews = [self argumentInputViews];
50-
self.fieldEditorView.fieldDescription = [NSAttributedString stringWithFormat:@"Signature:\n%@\n\nReturn Type:\n%s", self.method.description, [NSString stringWithFormat:@"%s", (char *)self.method.returnType].attributedString];
50+
self.fieldEditorView.fieldDescription = [NSAttributedString stringWithFormat:@"Signature:\n%@\n\nReturn Type:\n%@", self.method.description, [NSString stringWithFormat:@"%s", (char *)self.method.returnType].attributedString];
5151
}
5252

5353
- (NSArray<FLEXArgumentInputView *> *)argumentInputViews {

Classes/Utility/Categories/FLEXRuntime+Compare.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@implementation FLEXProperty (Compare)
1212

1313
- (NSComparisonResult)compare:(FLEXProperty *)other {
14-
NSComparisonResult r = [self.name caseInsensitiveCompare:other.name];
14+
NSComparisonResult r = [self.name.string caseInsensitiveCompare:other.name.string];
1515
if (r == NSOrderedSame) {
1616
// TODO make sure empty image name sorts above an image name
1717
return [self.imageName ?: @"" compare:other.imageName];
@@ -25,7 +25,7 @@ - (NSComparisonResult)compare:(FLEXProperty *)other {
2525
@implementation FLEXIvar (Compare)
2626

2727
- (NSComparisonResult)compare:(FLEXIvar *)other {
28-
return [self.name caseInsensitiveCompare:other.name];
28+
return [self.name.string caseInsensitiveCompare:other.name.string];
2929
}
3030

3131
@end

Classes/Utility/Categories/NSAttributedString+FLEX.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
//
88

99
#import <Foundation/Foundation.h>
10+
#import "NSMutableAttributedString+FLEX.h"
1011

1112
@interface NSAttributedString (FLEX)
1213
+ (instancetype)stringByJoiningArray:(NSArray<NSAttributedString *> *)array withSeparator:(NSAttributedString *)separator;
1314
+ (instancetype)stringWithFormat:(NSString *)format, ...;
1415
+ (instancetype)stringWithAttributes:(NSDictionary *)attributes format:(NSString *)format, ...;
1516
- (instancetype)stringByAppendingAttributedString:(NSAttributedString *)aString;
17+
- (instancetype)stringByReplacingOccurrencesOfString:(NSAttributedString *)aString withString:(NSAttributedString *)replacement;
1618
@end

Classes/Utility/Categories/NSAttributedString+FLEX.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ - (instancetype)stringByAppendingAttributedString:(NSAttributedString *)aString
6262
[attributedString appendAttributedString:aString];
6363
return attributedString;
6464
}
65+
- (instancetype)stringByReplacingOccurrencesOfString:(NSAttributedString *)aString withString:(NSAttributedString *)replacement {
66+
NSMutableAttributedString *attributedString = self.mutableCopy;
67+
[attributedString replaceOccurencesOfString:aString withString:replacement];
68+
return attributedString;
69+
}
6570
@end
6671

Classes/Utility/Categories/NSObject+Reflection.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ + (FLEXProperty *)flex_classPropertyNamed:(NSString *)name {
424424
}
425425

426426
+ (void)flex_replaceProperty:(FLEXProperty *)property {
427-
[self flex_replaceProperty:property.name attributes:property.attributes];
427+
[self flex_replaceProperty:property.name.string attributes:property.attributes];
428428
}
429429

430430
+ (void)flex_replaceProperty:(NSString *)name attributes:(FLEXPropertyAttributes *)attributes {

Classes/Utility/Runtime/FLEXRuntimeUtility.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
+ (NSUInteger)fieldNameOffsetForTypeEncoding:(const FLEXTypeEncoding *)typeEncoding;
4646
/// Given name "foo" and type "int" this would return "int foo", but
4747
/// given name "foo" and type "T *" it would return "T *foo"
48-
+ (NSString *)appendName:(NSString *)name toType:(NSString *)typeEncoding;
48+
+ (NSAttributedString *)appendName:(NSAttributedString *)name toType:(NSAttributedString *)typeEncoding;
4949

5050
/// @return The class hierarchy for the given object or class,
5151
/// from the current class to the root-most class.
@@ -84,6 +84,6 @@
8484

8585
#pragma mark - Metadata Helpers
8686

87-
+ (NSString *)readableTypeForEncoding:(NSString *)encodingString;
87+
+ (NSAttributedString *)readableTypeForEncoding:(NSString *)encodingString;
8888

8989
@end

0 commit comments

Comments
 (0)