Start home timeline

This commit is contained in:
Shadowfacts 2018-08-16 22:39:16 -04:00
parent e7f6bc08a7
commit 824e74d9ed
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
9 changed files with 177 additions and 27 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "MastodonKit"] [submodule "MastodonKit"]
path = MastodonKit path = MastodonKit
url = git://github.com/MastodonKit/MastodonKit.git url = git://github.com/MastodonKit/MastodonKit.git
[submodule "SwiftSoup"]
path = SwiftSoup
url = git://github.com/scinfu/SwiftSoup.git

1
SwiftSoup Submodule

@ -0,0 +1 @@
Subproject commit f445c9067d28346e828e615e2b43cb07b20bca35

View File

@ -7,6 +7,9 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
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 */; };
D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */; }; D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */; };
D6D4DDD2212518A000E1C4BB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDD1212518A000E1C4BB /* ViewController.swift */; }; D6D4DDD2212518A000E1C4BB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDD1212518A000E1C4BB /* ViewController.swift */; };
D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD3212518A000E1C4BB /* Main.storyboard */; }; D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD3212518A000E1C4BB /* Main.storyboard */; };
@ -46,6 +49,7 @@
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
D6F953E8212519A400CF0F2B /* MastodonKit.framework in Embed Frameworks */, D6F953E8212519A400CF0F2B /* MastodonKit.framework in Embed Frameworks */,
D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -53,6 +57,8 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
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 = "<group>"; };
D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; }; D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; };
D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D6D4DDD1212518A000E1C4BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; D6D4DDD1212518A000E1C4BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@ -78,6 +84,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D6F953E7212519A400CF0F2B /* MastodonKit.framework in Frameworks */, D6F953E7212519A400CF0F2B /* MastodonKit.framework in Frameworks */,
D6BED16F212663DA00F02DA0 /* SwiftSoup.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -98,9 +105,18 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
D6BED1722126661300F02DA0 /* Views */ = {
isa = PBXGroup;
children = (
D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */,
);
path = Views;
sourceTree = "<group>";
};
D6D4DDC3212518A000E1C4BB = { D6D4DDC3212518A000E1C4BB = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */,
D6F953E6212519A400CF0F2B /* MastodonKit.framework */, D6F953E6212519A400CF0F2B /* MastodonKit.framework */,
D6D4DDCE212518A000E1C4BB /* Tusker */, D6D4DDCE212518A000E1C4BB /* Tusker */,
D6D4DDE3212518A200E1C4BB /* TuskerTests */, D6D4DDE3212518A200E1C4BB /* TuskerTests */,
@ -125,6 +141,7 @@
D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */, D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */,
D6F953F121251A2F00CF0F2B /* Controllers */, D6F953F121251A2F00CF0F2B /* Controllers */,
D6F953E9212519B800CF0F2B /* View Controllers */, D6F953E9212519B800CF0F2B /* View Controllers */,
D6BED1722126661300F02DA0 /* Views */,
D6F953EA212519BE00CF0F2B /* Storyboards */, D6F953EA212519BE00CF0F2B /* Storyboards */,
D6D4DDD6212518A200E1C4BB /* Assets.xcassets */, D6D4DDD6212518A200E1C4BB /* Assets.xcassets */,
D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */, D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */,
@ -311,6 +328,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */, D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */,
D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */,
D6D4DDD2212518A000E1C4BB /* ViewController.swift in Sources */, D6D4DDD2212518A000E1C4BB /* ViewController.swift in Sources */,
D6F953EC212519E700CF0F2B /* StatusesTableViewController.swift in Sources */, D6F953EC212519E700CF0F2B /* StatusesTableViewController.swift in Sources */,
D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */, D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */,

View File

@ -7,4 +7,7 @@
<FileRef <FileRef
location = "group:MastodonKit/MastodonKit.xcodeproj"> location = "group:MastodonKit/MastodonKit.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:SwiftSoup/SwiftSoup.xcodeproj">
</FileRef>
</Workspace> </Workspace>

View File

@ -35,6 +35,11 @@ class MastodonController {
login() login()
} }
client.run(Accounts.currentUser()) { result in
guard case let .success(account, _) = result else { fatalError() }
print(account.acct)
}
} }
private func register(completion: @escaping () -> Void) { private func register(completion: @escaping () -> Void) {

View File

@ -1,28 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="lT6-W8-WVA"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="hVq-Vu-bEj">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--Statuses-->
<scene sceneID="Zb4-Yf-eZC"> <scene sceneID="OOu-1s-V6q">
<objects> <objects>
<viewController id="lT6-W8-WVA" customClass="ViewController" customModule="Tusker" customModuleProvider="target" sceneMemberID="viewController"> <viewControllerPlaceholder storyboardName="Statuses" id="7WZ-zC-GaE" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="bp8-bv-zit"> <tabBarItem key="tabBarItem" title="Item" id="qa8-hW-VHL"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> </viewControllerPlaceholder>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <placeholder placeholderIdentifier="IBFirstResponder" id="O8i-mP-ani" userLabel="First Responder" sceneMemberID="firstResponder"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="yNt-Ic-ase"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xjF-Uf-9dh" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-210" y="32"/> <point key="canvasLocation" x="385" y="-206"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="ELt-Cr-gbC">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="hVq-Vu-bEj" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="cjv-gb-Kie">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="7WZ-zC-GaE" kind="relationship" relationship="viewControllers" id="q0Z-gP-JDT"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1cN-fA-SM9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-210.40000000000001" y="31.934032983508249"/>
</scene> </scene>
</scenes> </scenes>
</document> </document>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="6nb-nb-cMm"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="CK3-h7-JHA">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
@ -17,13 +17,48 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="n0V-Nu-zEt"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="statusCell" rowHeight="72" id="n0V-Nu-zEt" customClass="StatusTableViewCell" customModule="Tusker" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="44"/> <rect key="frame" x="0.0" y="28" width="375" height="72"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="n0V-Nu-zEt" id="JcO-MN-o4M"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="n0V-Nu-zEt" id="JcO-MN-o4M">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="375" height="71.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZFA-wR-9b4">
<rect key="frame" x="16" y="11" width="103" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ffn-MC-jPW">
<rect key="frame" x="127" y="11" width="94" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Content" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xX6-Gq-MFH">
<rect key="frame" x="16" y="40" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="trailing" secondItem="JcO-MN-o4M" secondAttribute="trailingMargin" id="3uJ-2V-odU"/>
<constraint firstItem="Ffn-MC-jPW" firstAttribute="leading" secondItem="ZFA-wR-9b4" secondAttribute="trailing" constant="8" id="Az0-iw-JrZ"/>
<constraint firstItem="Ffn-MC-jPW" firstAttribute="top" secondItem="JcO-MN-o4M" secondAttribute="topMargin" id="I7N-O4-Q6U"/>
<constraint firstItem="ZFA-wR-9b4" firstAttribute="leading" secondItem="JcO-MN-o4M" secondAttribute="leadingMargin" id="OGD-sl-OQI"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="bottom" secondItem="JcO-MN-o4M" secondAttribute="bottomMargin" id="Td8-7G-sJ7"/>
<constraint firstItem="ZFA-wR-9b4" firstAttribute="top" secondItem="JcO-MN-o4M" secondAttribute="topMargin" id="a0F-RV-jI0"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="leading" secondItem="JcO-MN-o4M" secondAttribute="leadingMargin" id="oSD-4i-vYB"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="top" secondItem="ZFA-wR-9b4" secondAttribute="bottom" constant="8" id="ufm-zI-r2q"/>
</constraints>
</tableViewCellContentView> </tableViewCellContentView>
<connections>
<outlet property="contentLabel" destination="xX6-Gq-MFH" id="d7X-0B-daj"/>
<outlet property="displayNameLabel" destination="ZFA-wR-9b4" id="4Bg-aE-tVd"/>
<outlet property="usernameLabel" destination="Ffn-MC-jPW" id="dfo-KY-c7S"/>
</connections>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
<connections> <connections>
@ -31,10 +66,32 @@
<outlet property="delegate" destination="6nb-nb-cMm" id="Dio-U3-a5Z"/> <outlet property="delegate" destination="6nb-nb-cMm" id="Dio-U3-a5Z"/>
</connections> </connections>
</tableView> </tableView>
<navigationItem key="navigationItem" id="SQS-FM-ReS"/>
<simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5GO-2u-UCr" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="5GO-2u-UCr" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-138" y="-90"/> <point key="canvasLocation" x="800.79999999999995" y="-90.404797601199405"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="yNQ-ej-ymp">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="CK3-h7-JHA" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="mostRecent" id="dzR-Qn-Pf3"/>
<toolbarItems/>
<simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="kM6-kS-XRr">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="6nb-nb-cMm" kind="relationship" relationship="rootViewController" id="Ga2-04-Wda"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2IM-IS-Cf8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-138.40000000000001" y="-90.404797601199405"/>
</scene> </scene>
</scenes> </scenes>
</document> </document>

View File

@ -7,12 +7,32 @@
// //
import UIKit import UIKit
import MastodonKit
import SwiftSoup
class StatusesTableViewController: UITableViewController { class StatusesTableViewController: UITableViewController {
var statuses: [Status] = [] {
didSet {
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
}
override func viewWillAppear(_ animated: Bool) {
MastodonController.shared.client.run(Timelines.home()) { result in
guard case let .success(statuses, _) = result else { fatalError() }
self.statuses = statuses
}
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 140
// Uncomment the following line to preserve selection between presentations // Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false // self.clearsSelectionOnViewWillAppear = false
@ -23,24 +43,27 @@ class StatusesTableViewController: UITableViewController {
// MARK: - Table view data source // MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int { override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections return 1
return 0
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows // #warning Incomplete implementation, return the number of rows
return 0 return statuses.count
} }
/*
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
// Configure the cell... override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "statusCell", for: indexPath) as? StatusTableViewCell else {
fatalError()
}
let status = statuses[indexPath.row]
cell.updateUI(for: status)
return cell return cell
} }
*/
/* /*
// Override to support conditional editing of the table view. // Override to support conditional editing of the table view.

View File

@ -0,0 +1,29 @@
//
// StatusTableViewCell.swift
// Tusker
//
// Created by Shadowfacts on 8/16/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
import MastodonKit
import SwiftSoup
class StatusTableViewCell: UITableViewCell {
@IBOutlet weak var displayNameLabel: UILabel!
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var contentLabel: UILabel!
func updateUI(for status: Status) {
displayNameLabel.text = status.account.displayName
usernameLabel.text = "@\(status.account.acct)"
let doc = try! SwiftSoup.parse(status.content)
let text = (try! doc.body()?.text())!
contentLabel.text = text
}
}