Skip to content

Commit

Permalink
Use viewDidLoad over awakeFromNib for KVO init
Browse files Browse the repository at this point in the history
awakeFromNib can potentially be called multiple times; in our case twice
because it needs to load the view controller and then the file owner,
which is the view controller again. viewDidLoad is called once.

Also, remove a duplicate segue.
  • Loading branch information
saagarjha committed Oct 25, 2020
1 parent 1dbe4c2 commit 4ba3852
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions app/Roots.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="2wD-dq-vPG" kind="show" id="qCX-jp-cr9"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Default Root" textLabel="c8w-0c-rgD" detailTextLabel="s1e-Wg-AtO" style="IBUITableViewCellStyleSubtitle" id="o8d-j7-u1g">
<rect key="frame" x="0.0" y="99" width="736" height="55.666667938232422"/>
Expand Down
4 changes: 2 additions & 2 deletions app/RootsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ @interface RootDetailViewController : UITableViewController <UIDocumentPickerDel

@implementation RootsTableViewController

- (void)awakeFromNib {
[super awakeFromNib];
- (void)viewDidLoad {
[super viewDidLoad];
[Roots.instance addObserver:self forKeyPath:@"roots" options:0 context:nil];
[Roots.instance addObserver:self forKeyPath:@"defaultRoot" options:0 context:nil];
}
Expand Down

0 comments on commit 4ba3852

Please sign in to comment.