Skip to content

Commit

Permalink
[iOS] Fix naming in platform_view example (#144247)
Browse files Browse the repository at this point in the history
This applies minor cosmetic cleanups noticed while landing fix/tests in another patch. Renames `incrementLabel` to `countLabel` and `setIncrementLabel` to `updateCountLabel`, since it's not setting it to a specific value but rather updating itself based on the current state of the `count` ivar.

No tests since this patch introduces no semantic changes.

Related: flutter/flutter#132028
  • Loading branch information
cbracken authored Feb 27, 2024
1 parent 2eee0b5 commit 2e4bbb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</constraints>
</view>
<connections>
<outlet property="incrementLabel" destination="qaB-rs-mWp" id="bFY-of-WoI"/>
<outlet property="countLabel" destination="qaB-rs-mWp" id="bFY-of-WoI"/>
<outlet property="incrementButton" destination="6yL-sX-bUL" id="aQR-ap-BrT"/>
</connections>
</viewController>
Expand Down
10 changes: 5 additions & 5 deletions examples/platform_view/ios/Runner/PlatformViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@
#import <Foundation/Foundation.h>

@interface PlatformViewController ()
@property(weak, nonatomic) IBOutlet UILabel* incrementLabel;
@property(weak, nonatomic) IBOutlet UILabel* countLabel;
@end

@implementation PlatformViewController

- (void)viewDidLoad {
[super viewDidLoad];
[self setIncrementLabelText];
[self updateCountLabelText];
}

- (IBAction)handleIncrement:(id)sender {
self.counter++;
[self setIncrementLabelText];
[self updateCountLabelText];
}

- (IBAction)switchToFlutterView:(id)sender {
[self.delegate didUpdateCounter:self.counter];
[self dismissViewControllerAnimated:NO completion:nil];
}

- (void)setIncrementLabelText {
- (void)updateCountLabelText {
NSString* text = [NSString stringWithFormat:@"Button tapped %d %@.", self.counter,
(self.counter == 1) ? @"time" : @"times"];
self.incrementLabel.text = text;
self.countLabel.text = text;
}

@end

0 comments on commit 2e4bbb7

Please sign in to comment.