From b655c20e3d4909c5eae87e75dd9e95de9e25aca3 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 27 Aug 2018 16:32:59 -0400 Subject: [PATCH] Move StatusTableViewCell to separate nib --- Tusker.xcodeproj/project.pbxproj | 4 ++ Tusker/Storyboards/Timeline.storyboard | 56 --------------- .../TimelineTableViewController.swift | 16 +++-- Tusker/Views/StatusTableViewCell.xib | 69 +++++++++++++++++++ 4 files changed, 82 insertions(+), 63 deletions(-) create mode 100644 Tusker/Views/StatusTableViewCell.xib diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index b8e72e37..62fd8ec3 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; }; D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */; }; D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; }; + D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D667E5E02134937B0057A976 /* StatusTableViewCell.xib */; }; D6BED16F212663DA00F02DA0 /* SwiftSoup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; }; D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */; }; @@ -70,6 +71,7 @@ D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = ""; }; D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Onboarding.storyboard; sourceTree = ""; }; D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = ""; }; + D667E5E02134937B0057A976 /* StatusTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatusTableViewCell.xib; sourceTree = ""; }; D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = ""; }; D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -122,6 +124,7 @@ children = ( D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */, D64A0CD22132153900640E3B /* StatusContentLabel.swift */, + D667E5E02134937B0057A976 /* StatusTableViewCell.xib */, ); path = Views; sourceTree = ""; @@ -322,6 +325,7 @@ D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */, D6F953EE21251A0700CF0F2B /* Timeline.storyboard in Resources */, D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */, + D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tusker/Storyboards/Timeline.storyboard b/Tusker/Storyboards/Timeline.storyboard index 511f5e01..c0490d95 100644 --- a/Tusker/Storyboards/Timeline.storyboard +++ b/Tusker/Storyboards/Timeline.storyboard @@ -16,62 +16,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/View Controllers/TimelineTableViewController.swift b/Tusker/View Controllers/TimelineTableViewController.swift index 28354913..40901037 100644 --- a/Tusker/View Controllers/TimelineTableViewController.swift +++ b/Tusker/View Controllers/TimelineTableViewController.swift @@ -42,6 +42,15 @@ class TimelineTableViewController: UITableViewController { var newer: RequestRange? var older: RequestRange? + override func viewDidLoad() { + super.viewDidLoad() + + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 140 + + tableView.register(UINib(nibName: "StatusTableViewCell", bundle: nil), forCellReuseIdentifier: "statusCell") + } + override func viewWillAppear(_ animated: Bool) { guard MastodonController.shared.client?.accessToken != nil else { return } MastodonController.shared.client.run(timeline.request()) { result in @@ -54,13 +63,6 @@ class TimelineTableViewController: UITableViewController { } } } - - override func viewDidLoad() { - super.viewDidLoad() - - tableView.rowHeight = UITableView.automaticDimension - tableView.estimatedRowHeight = 140 - } /* // MARK: - Navigation diff --git a/Tusker/Views/StatusTableViewCell.xib b/Tusker/Views/StatusTableViewCell.xib new file mode 100644 index 00000000..6daf449e --- /dev/null +++ b/Tusker/Views/StatusTableViewCell.xib @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +