@@ -54,9 +54,9 @@ CGPoint ConvertPointToGlobal(SemanticsObject* reference, CGPoint local_point) {
54
54
// `rect` is in the physical pixel coordinate system. iOS expects the accessibility frame in
55
55
// the logical pixel coordinate system. Therefore, we divide by the `scale` (pixel ratio) to
56
56
// convert.
57
- UIScreen* screen = [ reference.bridge->view () window ] .screen ;
57
+ UIScreen* screen = reference.bridge ->view (). window .screen ;
58
58
// Screen can be nil if the FlutterView is covered by another native view.
59
- CGFloat scale = screen == nil ? UIScreen.mainScreen . scale : screen .scale ;
59
+ CGFloat scale = ( screen ?: UIScreen.mainScreen ) .scale ;
60
60
auto result = CGPointMake (point.x () / scale, point.y () / scale);
61
61
return [reference.bridge->view () convertPoint: result toView: nil ];
62
62
}
@@ -82,9 +82,9 @@ CGRect ConvertRectToGlobal(SemanticsObject* reference, CGRect local_rect) {
82
82
// `rect` is in the physical pixel coordinate system. iOS expects the accessibility frame in
83
83
// the logical pixel coordinate system. Therefore, we divide by the `scale` (pixel ratio) to
84
84
// convert.
85
- UIScreen* screen = [ reference.bridge->view () window ] .screen ;
85
+ UIScreen* screen = reference.bridge ->view (). window .screen ;
86
86
// Screen can be nil if the FlutterView is covered by another native view.
87
- CGFloat scale = screen == nil ? UIScreen.mainScreen . scale : screen .scale ;
87
+ CGFloat scale = ( screen ?: UIScreen.mainScreen ) .scale ;
88
88
auto result =
89
89
CGRectMake (rect.x () / scale, rect.y () / scale, rect.width () / scale, rect.height () / scale);
90
90
return UIAccessibilityConvertFrameToScreenCoordinates (result, reference.bridge ->view ());
@@ -126,12 +126,8 @@ - (void)forwardInvocation:(NSInvocation*)anInvocation {
126
126
}
127
127
128
128
- (NSString *)accessibilityValue {
129
- if (self.node .HasFlag (flutter::SemanticsFlags::kIsToggled ) ||
130
- self.node .HasFlag (flutter::SemanticsFlags::kIsChecked )) {
131
- self.nativeSwitch .on = YES ;
132
- } else {
133
- self.nativeSwitch .on = NO ;
134
- }
129
+ self.nativeSwitch .on = self.node .HasFlag (flutter::SemanticsFlags::kIsToggled ) ||
130
+ self.node .HasFlag (flutter::SemanticsFlags::kIsChecked );
135
131
136
132
if (![self isAccessibilityBridgeAlive ]) {
137
133
return nil ;
@@ -141,11 +137,7 @@ - (NSString*)accessibilityValue {
141
137
}
142
138
143
139
- (UIAccessibilityTraits)accessibilityTraits {
144
- if (self.node .HasFlag (flutter::SemanticsFlags::kIsEnabled )) {
145
- self.nativeSwitch .enabled = YES ;
146
- } else {
147
- self.nativeSwitch .enabled = NO ;
148
- }
140
+ self.nativeSwitch .enabled = self.node .HasFlag (flutter::SemanticsFlags::kIsEnabled );
149
141
150
142
return self.nativeSwitch .accessibilityTraits ;
151
143
}
0 commit comments