Browse Source

Add 3D Touch support

master
Dwayne Harris 6 years ago
parent
commit
b252e4f468
  1. 11
      elpha-ios.xcodeproj/project.pbxproj
  2. 2
      elpha-ios/AppDelegate.swift
  3. 215
      elpha-ios/Base.lproj/Main.storyboard
  4. 42
      elpha-ios/InstanceViewController.swift
  5. 31
      elpha-ios/InstancesTableViewController.swift

11
elpha-ios.xcodeproj/project.pbxproj

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
157405A82150588A00EEAAEB /* InstanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157405A72150588A00EEAAEB /* InstanceViewController.swift */; };
15830D93214F6F6F0037C342 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15830D92214F6F6F0037C342 /* ImageCache.swift */; };
159048AF214F5015004F4014 /* InstancesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 159048AE214F5015004F4014 /* InstancesTableViewCell.swift */; };
15960E5B213145E100C38CE9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E5A213145E100C38CE9 /* AppDelegate.swift */; };
@ -29,6 +30,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
157405A72150588A00EEAAEB /* InstanceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstanceViewController.swift; sourceTree = "<group>"; };
15830D92214F6F6F0037C342 /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
159048AE214F5015004F4014 /* InstancesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstancesTableViewCell.swift; sourceTree = "<group>"; };
15960E57213145E100C38CE9 /* elpha-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "elpha-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -118,6 +120,7 @@
15960E852137775D00C38CE9 /* InstancesNavigationController.swift */,
15960E87213902A400C38CE9 /* InstancesTableView.swift */,
159048AE214F5015004F4014 /* InstancesTableViewCell.swift */,
157405A72150588A00EEAAEB /* InstanceViewController.swift */,
);
name = "View Controllers";
sourceTree = "<group>";
@ -154,6 +157,7 @@
TargetAttributes = {
15960E56213145E100C38CE9 = {
CreatedOnToolsVersion = 9.4.1;
LastSwiftMigration = 1000;
};
};
};
@ -206,6 +210,7 @@
15960E5B213145E100C38CE9 /* AppDelegate.swift in Sources */,
15960E7721322C6F00C38CE9 /* Configuration.swift in Sources */,
15960E7521322BF800C38CE9 /* KeychainWrapper.swift in Sources */,
157405A82150588A00EEAAEB /* InstanceViewController.swift in Sources */,
15960E7321322BC700C38CE9 /* KeychainItemAccessibility.swift in Sources */,
15960E862137775D00C38CE9 /* InstancesNavigationController.swift in Sources */,
15960E822136668500C38CE9 /* TimelinesNavigationController.swift in Sources */,
@ -355,13 +360,14 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = R9PMLQGTGZ;
INFOPLIST_FILE = "elpha-ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "xyz.elpha.elpha-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
@ -373,13 +379,14 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = R9PMLQGTGZ;
INFOPLIST_FILE = "elpha-ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "xyz.elpha.elpha-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;

2
elpha-ios/AppDelegate.swift

@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

215
elpha-ios/Base.lproj/Main.storyboard

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -36,13 +34,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter a Mastodon Instance" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nru-sM-bKD">
<rect key="frame" x="10" y="303" width="355" height="21"/>
<rect key="frame" x="10" y="302.5" width="355" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="mastodon.social" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="02G-kI-p4F">
<rect key="frame" x="10" y="344" width="355" height="40"/>
<rect key="frame" x="10" y="343.5" width="355" height="40"/>
<color key="backgroundColor" red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="rOZ-m9-lp9"/>
@ -52,7 +50,7 @@
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="awW-03-3TB">
<rect key="frame" x="80" y="404" width="215" height="40"/>
<rect key="frame" x="80" y="403.5" width="215" height="40"/>
<color key="backgroundColor" red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="gl3-OE-jFa"/>
@ -61,13 +59,14 @@
<color key="titleColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TUU-fE-p3J">
<rect key="frame" x="0.0" y="581" width="375" height="86"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TUU-fE-p3J">
<rect key="frame" x="0.0" y="577" width="375" height="90"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ABr-tX-v5Y">
<rect key="frame" x="131" y="30" width="112" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ABr-tX-v5Y">
<rect key="frame" x="131.5" y="30" width="112" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="TdG-vz-Mhq"/>
</constraints>
<state key="normal" title="Find an Instance">
<color key="titleColor" red="0.090196078430000007" green="0.047058823530000002" blue="0.28627450980000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
@ -77,15 +76,20 @@
</button>
</subviews>
<color key="backgroundColor" red="0.72941176470588232" green="0.6705882352941176" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="ABr-tX-v5Y" firstAttribute="centerY" secondItem="TUU-fE-p3J" secondAttribute="centerY" id="CPO-h3-mtc"/>
<constraint firstAttribute="height" constant="90" id="Zbi-jD-noT"/>
<constraint firstItem="ABr-tX-v5Y" firstAttribute="centerX" secondItem="TUU-fE-p3J" secondAttribute="centerX" id="amm-fS-RiO"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="sjL-eq-q6s">
<rect key="frame" x="0.0" y="78" width="375" height="175"/>
<rect key="frame" x="0.0" y="77.5" width="375" height="175"/>
<constraints>
<constraint firstAttribute="height" constant="175" id="O4x-xb-MbJ"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kt3-Mk-URm">
<rect key="frame" x="148" y="454" width="79" height="27"/>
<rect key="frame" x="148" y="453.5" width="79" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<state key="normal" title="Privacy Policy">
<color key="titleColor" red="0.54117647059999996" green="0.4823529412" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>
@ -100,16 +104,17 @@
<constraint firstItem="02G-kI-p4F" firstAttribute="top" secondItem="Nru-sM-bKD" secondAttribute="bottom" constant="20" id="B7M-5H-Zg0"/>
<constraint firstAttribute="trailing" secondItem="sjL-eq-q6s" secondAttribute="trailing" id="BAU-nb-aTg"/>
<constraint firstItem="awW-03-3TB" firstAttribute="leading" secondItem="x4b-tk-8EQ" secondAttribute="leading" constant="80" id="FNY-pl-Yec"/>
<constraint firstItem="TUU-fE-p3J" firstAttribute="trailing" secondItem="x4b-tk-8EQ" secondAttribute="trailing" id="HZc-cz-fEl"/>
<constraint firstItem="x4b-tk-8EQ" firstAttribute="trailing" secondItem="02G-kI-p4F" secondAttribute="trailing" constant="10" id="NXw-TG-cic"/>
<constraint firstItem="x4b-tk-8EQ" firstAttribute="trailing" secondItem="Nru-sM-bKD" secondAttribute="trailing" constant="10" id="Sxb-jU-m0V"/>
<constraint firstItem="TUU-fE-p3J" firstAttribute="bottom" secondItem="x4b-tk-8EQ" secondAttribute="bottom" id="VH8-EU-1Ia"/>
<constraint firstItem="Nru-sM-bKD" firstAttribute="leading" secondItem="x4b-tk-8EQ" secondAttribute="leading" constant="10" id="WEA-WC-yja"/>
<constraint firstItem="Nru-sM-bKD" firstAttribute="top" secondItem="sjL-eq-q6s" secondAttribute="bottom" constant="50" id="gne-4p-g6Z"/>
<constraint firstItem="awW-03-3TB" firstAttribute="top" secondItem="02G-kI-p4F" secondAttribute="bottom" constant="20" id="j0m-WK-H0R"/>
<constraint firstItem="02G-kI-p4F" firstAttribute="centerY" secondItem="ITR-hY-wTb" secondAttribute="centerY" constant="30" id="lBM-lg-9GD"/>
<constraint firstItem="sjL-eq-q6s" firstAttribute="leading" secondItem="ITR-hY-wTb" secondAttribute="leading" id="mmG-4E-tPk"/>
<constraint firstItem="awW-03-3TB" firstAttribute="centerX" secondItem="ITR-hY-wTb" secondAttribute="centerX" id="oeo-dW-WfL"/>
<constraint firstItem="TUU-fE-p3J" firstAttribute="leading" secondItem="x4b-tk-8EQ" secondAttribute="leading" id="qcd-hc-FQP"/>
<constraint firstItem="sjL-eq-q6s" firstAttribute="centerX" secondItem="ITR-hY-wTb" secondAttribute="centerX" id="qe1-tM-Uhm"/>
<constraint firstItem="Nru-sM-bKD" firstAttribute="centerX" secondItem="ITR-hY-wTb" secondAttribute="centerX" id="z6W-yV-Co1"/>
<constraint firstItem="kt3-Mk-URm" firstAttribute="centerX" secondItem="ITR-hY-wTb" secondAttribute="centerX" id="zog-gJ-Jb6"/>
</constraints>
<viewLayoutGuide key="safeArea" id="x4b-tk-8EQ"/>
@ -123,7 +128,7 @@
</objects>
<point key="canvasLocation" x="-615.20000000000005" y="770.46476761619192"/>
</scene>
<!--Instances Table View Controller-->
<!--Instances-->
<scene sceneID="24Q-ad-dey">
<objects>
<tableViewController id="bRx-56-pJs" customClass="InstancesTableViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
@ -132,11 +137,11 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="InstancesTableViewCell" rowHeight="120" id="t5I-4e-rPV" customClass="InstancesTableViewCell" customModule="elpha_ios" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="InstancesTableViewCell" rowHeight="120" id="t5I-4e-rPV" customClass="InstancesTableViewCell" customModule="elpha_ios" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="120"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="t5I-4e-rPV" id="Awg-lg-91F">
<rect key="frame" x="0.0" y="0.0" width="375" height="119.5"/>
<rect key="frame" x="0.0" y="0.0" width="341" height="119.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Instance Placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="3lE-eD-RSI">
@ -146,7 +151,7 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="scl-0p-jQO">
<rect key="frame" x="124" y="26" width="227" height="30"/>
<rect key="frame" x="124" y="11" width="201" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="v20-Wv-cjD"/>
</constraints>
@ -154,51 +159,77 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Statuses" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GvU-C8-JYy">
<rect key="frame" x="124" y="64" width="100" height="16"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EuF-dW-Uua">
<rect key="frame" x="201.5" y="46" width="53" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Statuses" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GvU-C8-JYy">
<rect key="frame" x="0.0" y="8" width="53" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="aZP-9T-7kG"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.66422420739999999" green="0.66424006219999998" blue="0.66423153879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4n9-eS-zCc">
<rect key="frame" x="0.0" y="29" width="53" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="FNh-pN-i9Y"/>
<constraint firstAttribute="trailing" secondItem="GvU-C8-JYy" secondAttribute="trailing" id="2f5-Np-4uw"/>
<constraint firstItem="4n9-eS-zCc" firstAttribute="top" secondItem="GvU-C8-JYy" secondAttribute="bottom" constant="5" id="7U7-GE-2qR"/>
<constraint firstAttribute="bottom" secondItem="4n9-eS-zCc" secondAttribute="bottom" id="QpH-74-JaJ"/>
<constraint firstAttribute="trailing" secondItem="4n9-eS-zCc" secondAttribute="trailing" id="bi1-Sy-z8R"/>
<constraint firstItem="4n9-eS-zCc" firstAttribute="leading" secondItem="EuF-dW-Uua" secondAttribute="leading" id="d8z-ug-Jzk"/>
<constraint firstItem="GvU-C8-JYy" firstAttribute="leading" secondItem="EuF-dW-Uua" secondAttribute="leading" id="fs1-q3-PBE"/>
<constraint firstItem="GvU-C8-JYy" firstAttribute="top" secondItem="EuF-dW-Uua" secondAttribute="top" constant="8" id="kqn-GO-3hE"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.66422420739999999" green="0.66424006219999998" blue="0.66423153879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4n9-eS-zCc">
<rect key="frame" x="124" y="84" width="100" height="17"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ir1-Wt-maG">
<rect key="frame" x="124" y="46" width="37.5" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Users" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x17-3V-ix0">
<rect key="frame" x="0.0" y="8" width="37.5" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="cyk-90-Tuq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.66422420739999999" green="0.66424006219999998" blue="0.66423153879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4fE-NE-pXx">
<rect key="frame" x="0.0" y="29" width="37.5" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="ddf-nO-YtD"/>
<constraint firstItem="x17-3V-ix0" firstAttribute="leading" secondItem="Ir1-Wt-maG" secondAttribute="leading" id="Brc-jJ-ZBs"/>
<constraint firstItem="4fE-NE-pXx" firstAttribute="leading" secondItem="Ir1-Wt-maG" secondAttribute="leading" id="C6q-Gp-oWg"/>
<constraint firstItem="4fE-NE-pXx" firstAttribute="top" secondItem="x17-3V-ix0" secondAttribute="bottom" constant="5" id="W67-q6-fd5"/>
<constraint firstAttribute="bottom" secondItem="4fE-NE-pXx" secondAttribute="bottom" id="dYt-8T-5TV"/>
<constraint firstItem="x17-3V-ix0" firstAttribute="top" secondItem="Ir1-Wt-maG" secondAttribute="top" constant="8" id="iuD-g8-CL2"/>
<constraint firstAttribute="trailing" secondItem="4fE-NE-pXx" secondAttribute="trailing" id="tDX-a4-kO7"/>
<constraint firstAttribute="trailing" secondItem="x17-3V-ix0" secondAttribute="trailing" id="ytQ-Dh-a2s"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Users" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x17-3V-ix0">
<rect key="frame" x="232" y="64" width="35.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.66422420739999999" green="0.66424006219999998" blue="0.66423153879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4fE-NE-pXx">
<rect key="frame" x="232" y="84" width="38" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</view>
</subviews>
<constraints>
<constraint firstItem="EuF-dW-Uua" firstAttribute="leading" secondItem="Ir1-Wt-maG" secondAttribute="trailing" constant="40" id="1wb-51-hps"/>
<constraint firstAttribute="trailingMargin" secondItem="scl-0p-jQO" secondAttribute="trailing" constant="8" id="9a9-Za-5xy"/>
<constraint firstAttribute="bottomMargin" secondItem="3lE-eD-RSI" secondAttribute="bottom" id="C3d-Xw-1NM"/>
<constraint firstItem="3lE-eD-RSI" firstAttribute="top" secondItem="Awg-lg-91F" secondAttribute="topMargin" id="E5j-M3-x38"/>
<constraint firstItem="GvU-C8-JYy" firstAttribute="leading" secondItem="3lE-eD-RSI" secondAttribute="trailing" constant="8" id="L1f-Ou-oJM"/>
<constraint firstItem="GvU-C8-JYy" firstAttribute="top" secondItem="scl-0p-jQO" secondAttribute="bottom" constant="8" id="NWZ-Se-Yo2"/>
<constraint firstItem="x17-3V-ix0" firstAttribute="leading" secondItem="GvU-C8-JYy" secondAttribute="trailing" constant="8" id="SKd-eL-xTg"/>
<constraint firstItem="x17-3V-ix0" firstAttribute="top" secondItem="scl-0p-jQO" secondAttribute="bottom" constant="8" id="V9U-Fm-AlT"/>
<constraint firstItem="4fE-NE-pXx" firstAttribute="top" secondItem="x17-3V-ix0" secondAttribute="bottom" constant="4" id="Xuc-9Y-4VO"/>
<constraint firstItem="Ir1-Wt-maG" firstAttribute="leading" secondItem="3lE-eD-RSI" secondAttribute="trailing" constant="8" id="UFM-9U-iXk"/>
<constraint firstItem="scl-0p-jQO" firstAttribute="leading" secondItem="3lE-eD-RSI" secondAttribute="trailing" constant="8" id="Ybe-wP-f47"/>
<constraint firstItem="4fE-NE-pXx" firstAttribute="leading" secondItem="4n9-eS-zCc" secondAttribute="trailing" constant="8" id="aGK-30-q1o"/>
<constraint firstItem="4n9-eS-zCc" firstAttribute="top" secondItem="GvU-C8-JYy" secondAttribute="bottom" constant="4" id="kRr-tr-bPQ"/>
<constraint firstItem="scl-0p-jQO" firstAttribute="top" secondItem="Awg-lg-91F" secondAttribute="topMargin" constant="15" id="pf7-QJ-dXi"/>
<constraint firstItem="4n9-eS-zCc" firstAttribute="leading" secondItem="3lE-eD-RSI" secondAttribute="trailing" constant="8" id="rLU-Oz-WCd"/>
<constraint firstItem="EuF-dW-Uua" firstAttribute="top" secondItem="scl-0p-jQO" secondAttribute="bottom" constant="5" id="eVL-ay-uor"/>
<constraint firstItem="Ir1-Wt-maG" firstAttribute="top" secondItem="scl-0p-jQO" secondAttribute="bottom" constant="5" id="hGD-eC-hih"/>
<constraint firstItem="scl-0p-jQO" firstAttribute="top" secondItem="Awg-lg-91F" secondAttribute="topMargin" id="pf7-QJ-dXi"/>
<constraint firstItem="3lE-eD-RSI" firstAttribute="leading" secondItem="Awg-lg-91F" secondAttribute="leadingMargin" id="uVI-Cr-1hQ"/>
</constraints>
</tableViewCellContentView>
@ -207,6 +238,7 @@
<outlet property="statusesLabel" destination="4n9-eS-zCc" id="NQe-PG-1OF"/>
<outlet property="thumbnailImageView" destination="3lE-eD-RSI" id="4XF-Ca-fIV"/>
<outlet property="usersLabel" destination="4fE-NE-pXx" id="Svc-5P-YTj"/>
<segue destination="mhy-lU-rss" kind="show" identifier="InstanceDetailSegue" id="TiO-o8-8o6"/>
</connections>
</tableViewCell>
</prototypes>
@ -215,7 +247,7 @@
<outlet property="delegate" destination="bRx-56-pJs" id="PeE-yA-Kud"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="mfC-MW-ufJ"/>
<navigationItem key="navigationItem" title="Instances" largeTitleDisplayMode="always" id="mfC-MW-ufJ"/>
<connections>
<outlet property="mainNavigationItem" destination="mfC-MW-ufJ" id="YZK-rX-Gn3"/>
</connections>
@ -224,6 +256,72 @@
</objects>
<point key="canvasLocation" x="1064.8" y="1048.4257871064469"/>
</scene>
<!--Instance View Controller-->
<scene sceneID="u4y-73-40c">
<objects>
<viewController storyboardIdentifier="InstanceViewController" id="mhy-lU-rss" customClass="InstanceViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="PuO-1l-eXq">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UZR-kd-UxJ">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uMx-PR-Og0">
<rect key="frame" x="0.0" y="0.0" width="375" height="400"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="snd-Ts-rva">
<rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="VeP-LC-gew"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tS4-1x-aPh">
<rect key="frame" x="8" y="208" width="359" height="26.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="snd-Ts-rva" firstAttribute="leading" secondItem="uMx-PR-Og0" secondAttribute="leading" id="5PY-wc-Ih8"/>
<constraint firstItem="tS4-1x-aPh" firstAttribute="top" secondItem="snd-Ts-rva" secondAttribute="bottom" constant="8" id="5T8-Pf-0e3"/>
<constraint firstAttribute="height" constant="400" id="AAM-kQ-MTD"/>
<constraint firstAttribute="trailing" secondItem="snd-Ts-rva" secondAttribute="trailing" id="G6a-Hu-AbR"/>
<constraint firstItem="tS4-1x-aPh" firstAttribute="leading" secondItem="uMx-PR-Og0" secondAttribute="leading" constant="8" id="JF4-Mq-Nx1"/>
<constraint firstAttribute="trailing" secondItem="tS4-1x-aPh" secondAttribute="trailing" constant="8" id="mhC-An-xdr"/>
<constraint firstItem="snd-Ts-rva" firstAttribute="top" secondItem="uMx-PR-Og0" secondAttribute="top" id="wiP-BX-cCT"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="uMx-PR-Og0" secondAttribute="trailing" id="4rw-lT-BAn"/>
<constraint firstItem="uMx-PR-Og0" firstAttribute="leading" secondItem="UZR-kd-UxJ" secondAttribute="leading" id="Ksc-0i-pr0"/>
<constraint firstItem="uMx-PR-Og0" firstAttribute="top" secondItem="UZR-kd-UxJ" secondAttribute="top" id="k2t-6Z-K6k"/>
<constraint firstAttribute="bottom" secondItem="uMx-PR-Og0" secondAttribute="bottom" id="t02-sy-PxK"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="uMx-PR-Og0" firstAttribute="width" secondItem="PuO-1l-eXq" secondAttribute="width" id="IX5-nU-Hc3"/>
<constraint firstItem="UZR-kd-UxJ" firstAttribute="top" secondItem="sJg-YO-5B3" secondAttribute="top" id="Ix9-KQ-JY8"/>
<constraint firstItem="UZR-kd-UxJ" firstAttribute="trailing" secondItem="sJg-YO-5B3" secondAttribute="trailing" id="Y0u-h9-SvC"/>
<constraint firstItem="UZR-kd-UxJ" firstAttribute="bottom" secondItem="sJg-YO-5B3" secondAttribute="bottom" id="cOT-UE-dX7"/>
<constraint firstItem="UZR-kd-UxJ" firstAttribute="leading" secondItem="sJg-YO-5B3" secondAttribute="leading" id="enl-L4-jV8"/>
</constraints>
<viewLayoutGuide key="safeArea" id="sJg-YO-5B3"/>
</view>
<connections>
<outlet property="instanceNameLabel" destination="tS4-1x-aPh" id="Bb8-r9-Tdi"/>
<outlet property="thumbnailImageView" destination="snd-Ts-rva" id="WM4-wU-Bn5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2br-gN-kxb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1792.8" y="1047.5262368815593"/>
</scene>
<!--Second-->
<scene sceneID="wg7-f3-ORb">
<objects>
@ -310,9 +408,6 @@
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>
<textAttributes key="largeTitleTextAttributes">
<color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>

42
elpha-ios/InstanceViewController.swift

@ -0,0 +1,42 @@
//
// InstanceViewController.swift
// elpha-ios
//
// Created by Dwayne Harris on 9/17/18.
// Copyright © 2018 Elpha. All rights reserved.
//
import Foundation
import UIKit
class InstanceViewController: UIViewController {
@IBOutlet var thumbnailImageView: UIImageView!
@IBOutlet var instanceNameLabel: UILabel!
var instance: Instance? = nil
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
guard let instance = self.instance else {
fatalError("No instance")
}
print(instanceNameLabel)
print(thumbnailImageView)
instanceNameLabel?.text = instance.name
if let thumbnailURL = instance.thumbnail {
ImageCache.shared.getImage(forURL: URL(string: thumbnailURL)!) { image, error in
guard error == nil else {
return
}
DispatchQueue.main.async {
self.thumbnailImageView?.image = image
}
}
}
}
}

31
elpha-ios/InstancesTableViewController.swift

@ -36,7 +36,7 @@ struct Instance {
var categories: [String]?
}
class InstancesTableViewController: UITableViewController {
class InstancesTableViewController: UITableViewController, UIViewControllerPreviewingDelegate {
@IBOutlet var mainNavigationItem: UINavigationItem!
let instanceRequestCount = 20
@ -51,9 +51,10 @@ class InstancesTableViewController: UITableViewController {
UINavigationBar.appearance().barTintColor = UIColor.red
UINavigationBar.appearance().tintColor = UIColor.white
mainNavigationItem.title = "Mastodon Instances"
mainNavigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(done))
registerForPreviewing(with: self, sourceView: tableView)
loadInstances()
}
@ -199,4 +200,30 @@ class InstancesTableViewController: UITableViewController {
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "InstanceDetailSegue", let cell = segue.destination as? InstanceViewController {
if let row = tableView.indexPathForSelectedRow?.row {
cell.instance = instances[row]
}
}
}
public func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else {
return nil
}
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let detailViewController = storyboard.instantiateViewController(withIdentifier: "InstanceViewController") as? InstanceViewController {
detailViewController.instance = instances[indexPath.row]
return detailViewController
} else {
return nil
}
}
public func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
navigationController?.pushViewController(viewControllerToCommit, animated: true)
}
}
Loading…
Cancel
Save