Browse Source

Development

master
Dwayne Harris 6 years ago
parent
commit
0d6a05a7c5
  1. 10
      elpha-ios.xcodeproj/project.pbxproj
  2. 4
      elpha-ios/AccountTableViewController.swift
  3. 12
      elpha-ios/Assets.xcassets/Icons/Close.imageset/Contents.json
  4. BIN
      elpha-ios/Assets.xcassets/Icons/Close.imageset/x-square.pdf
  5. 12
      elpha-ios/Assets.xcassets/Icons/Share.imageset/Contents.json
  6. BIN
      elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf
  7. 6
      elpha-ios/Assets.xcassets/New Folder/Contents.json
  8. 40
      elpha-ios/AttachmentViewController.swift
  9. 97
      elpha-ios/Base.lproj/Main.storyboard
  10. 15
      elpha-ios/StatusTableViewController.swift
  11. 15
      elpha-ios/StatusView.swift
  12. 22
      elpha-ios/StatusView.xib
  13. 6
      elpha-ios/String+HtmlAttributed.swift
  14. 18
      elpha-ios/UITextViewFixed.swift

10
elpha-ios.xcodeproj/project.pbxproj

@ -51,6 +51,7 @@
15BB72AB2171A8D4002F1FA4 /* TimelinesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15BB72AA2171A8D4002F1FA4 /* TimelinesTableViewCell.swift */; };
15C91A02216AB2D600D97DC3 /* AlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 15C91A01216AB2D600D97DC3 /* AlertView.xib */; };
15C91A04216AB32500D97DC3 /* AlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15C91A03216AB32500D97DC3 /* AlertView.swift */; };
15CF7244219282AF00E6BF19 /* UITextViewFixed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15CF7243219282AF00E6BF19 /* UITextViewFixed.swift */; };
15F9981721629965009E58DA /* TimelineTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15F9981621629965009E58DA /* TimelineTableViewController.swift */; };
15F998352162C0E8009E58DA /* MastodonDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15F998342162C0E8009E58DA /* MastodonDataManager.swift */; };
/* End PBXBuildFile section */
@ -237,6 +238,7 @@
15BB72AA2171A8D4002F1FA4 /* TimelinesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesTableViewCell.swift; sourceTree = "<group>"; };
15C91A01216AB2D600D97DC3 /* AlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AlertView.xib; sourceTree = "<group>"; };
15C91A03216AB32500D97DC3 /* AlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertView.swift; sourceTree = "<group>"; };
15CF7243219282AF00E6BF19 /* UITextViewFixed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITextViewFixed.swift; sourceTree = "<group>"; };
15F9981621629965009E58DA /* TimelineTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTableViewController.swift; sourceTree = "<group>"; };
15F998342162C0E8009E58DA /* MastodonDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonDataManager.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -378,11 +380,12 @@
15960E59213145E100C38CE9 /* elpha-ios */ = {
isa = PBXGroup;
children = (
15960E5A213145E100C38CE9 /* AppDelegate.swift */,
15960E63213145E200C38CE9 /* Assets.xcassets */,
15960E7621322C6F00C38CE9 /* Configuration.swift */,
15960E6E21321FA500C38CE9 /* Elpha.xcdatamodeld */,
15960E68213145E200C38CE9 /* Info.plist */,
15960E6E21321FA500C38CE9 /* Elpha.xcdatamodeld */,
15960E5A213145E100C38CE9 /* AppDelegate.swift */,
15960E7621322C6F00C38CE9 /* Configuration.swift */,
15CF7243219282AF00E6BF19 /* UITextViewFixed.swift */,
156FF05621779C140074D9CA /* API */,
151AD4AF2166DDA000F07403 /* Extensions */,
15960E7121322B9F00C38CE9 /* Keychain Helper */,
@ -634,6 +637,7 @@
15960E7C213272CD00C38CE9 /* AuthenticationManager.swift in Sources */,
15B127922192467F00F4EF1D /* String+HtmlAttributed.swift in Sources */,
15960E7E21329FED00C38CE9 /* AuthenticateViewController.swift in Sources */,
15CF7244219282AF00E6BF19 /* UITextViewFixed.swift in Sources */,
15960E5B213145E100C38CE9 /* AppDelegate.swift in Sources */,
15131EF2216D8D570092B252 /* StatusView.swift in Sources */,
152734D22186DC74003DB3C8 /* TimelinesViewController.swift in Sources */,

4
elpha-ios/AccountTableViewController.swift

@ -74,7 +74,7 @@ class AccountTableViewController: UITableViewController {
}
displayNameLabel.text = account.displayName
usernameLabel.text = account.acct
usernameLabel.text = "@\(account.acct!)"
if let note = account.note {
contentLabel.attributedText = note.htmlAttributed(size: 15, centered: true)
@ -370,7 +370,7 @@ extension AccountTableViewController: StatusViewDelegate {
controller.status = status
controller.attachmentIndex = index
self.navigationController?.pushViewController(controller, animated: false)
present(controller, animated: false)
}
}
}

12
elpha-ios/Assets.xcassets/Icons/Close.imageset/Contents.json

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "x-square.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
elpha-ios/Assets.xcassets/Icons/Close.imageset/x-square.pdf

12
elpha-ios/Assets.xcassets/Icons/Share.imageset/Contents.json

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "share.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf

6
elpha-ios/Assets.xcassets/New Folder/Contents.json

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

40
elpha-ios/AttachmentViewController.swift

@ -9,30 +9,34 @@
import UIKit
class AttachmentViewController: UIViewController {
@IBOutlet var attachmentScrollView: UIScrollView!
@IBOutlet var attachmentImageView: UIImageView!
@IBOutlet var statusLabel: UILabel!
@IBOutlet var statusTextView: UITextView!
var attachment: AttachmentMO? = nil
@IBAction func closeTapped(_ sender: Any) {
if let controller = self.parent as? AttachmentPageViewController {
controller.dismissController()
}
}
@IBAction func shareTapped(_ sender: Any) {
if let image = attachmentImageView.image {
let controller = UIActivityViewController(activityItems: [image], applicationActivities: nil)
present(controller, animated: true)
}
}
override func viewDidLoad() {
super.viewDidLoad()
if let attachment = attachment {
attachmentScrollView.delegate = self
attachmentImageView.af_setImage(withURL: attachment.url!)
if let content = attachment.status?.content {
do {
let styledContent = "<style>html * { font-size: 14px; color: #ffffff; font-family: -apple-system } a:link { color: #ffffff } a:visited { color: #ffffff }</style> \(content)"
let attributedText = try NSAttributedString(
data: styledContent.data(using: String.Encoding.unicode, allowLossyConversion: true)!,
options: [.documentType: NSAttributedString.DocumentType.html],
documentAttributes: nil
)
statusLabel.attributedText = attributedText
} catch {
print("\(error)")
}
statusTextView.attributedText = content.htmlAttributed(size: 14, centered: true, color: UIColor.white)
}
}
}
@ -40,10 +44,10 @@ class AttachmentViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
@IBAction func imageSwiped(_ sender: Any) {
if let controller = self.parent as? AttachmentPageViewController {
controller.dismissController()
}
}
extension AttachmentViewController: UIScrollViewDelegate {
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return attachmentImageView
}
}

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

@ -1232,35 +1232,73 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView multipleTouchEnabled="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LVW-zt-JUe">
<rect key="frame" x="0.0" y="50" width="375" height="527"/>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" maximumZoomScale="6" translatesAutoresizingMaskIntoConstraints="NO" id="7ll-rV-5Xs">
<rect key="frame" x="0.0" y="83" width="375" height="464"/>
<subviews>
<imageView multipleTouchEnabled="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LVW-zt-JUe">
<rect key="frame" x="0.0" y="0.0" width="375" height="464"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<gestureRecognizers/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="LVW-zt-JUe" secondAttribute="bottom" id="0qr-Yp-kPR"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="width" secondItem="7ll-rV-5Xs" secondAttribute="width" id="JLj-W3-2Ga"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="top" secondItem="7ll-rV-5Xs" secondAttribute="top" id="KUF-iF-4Bm"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="height" secondItem="7ll-rV-5Xs" secondAttribute="height" id="NIw-NI-euN"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="leading" secondItem="7ll-rV-5Xs" secondAttribute="leading" id="OfC-8j-Fs1"/>
<constraint firstAttribute="trailing" secondItem="LVW-zt-JUe" secondAttribute="trailing" id="uZb-28-LNp"/>
</constraints>
</scrollView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" text="Content" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hd1-Nu-84c">
<rect key="frame" x="8" y="562" width="359" height="150"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Secondary"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="qx0-dd-I7h"/>
</constraints>
<color key="textColor" name="Background Primary"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="17"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Close" translatesAutoresizingMaskIntoConstraints="NO" id="WAn-22-dqH">
<rect key="frame" x="15" y="50" width="18" height="18"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="width" constant="18" id="41w-8a-D04"/>
<constraint firstAttribute="height" constant="18" id="Uq7-dH-nHr"/>
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="jGp-MJ-Wqo" appends="YES" id="T0x-sN-qnj"/>
<outletCollection property="gestureRecognizers" destination="d2a-nR-kSR" appends="YES" id="Zpm-xY-TMT"/>
<outletCollection property="gestureRecognizers" destination="9Gi-hE-TEp" appends="YES" id="Wyp-Na-DYj"/>
</connections>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Image Caption" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uOb-Wh-Ew6">
<rect key="frame" x="8" y="592" width="359" height="200"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Share" translatesAutoresizingMaskIntoConstraints="NO" id="vZ9-hY-vNA">
<rect key="frame" x="344" y="50" width="16" height="20"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="200" id="96X-fO-fxQ"/>
<constraint firstAttribute="height" constant="20" id="BTH-H7-RNW"/>
<constraint firstAttribute="width" constant="16" id="WpI-qD-h9S"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" name="Background Primary"/>
<nil key="highlightedColor"/>
</label>
<connections>
<outletCollection property="gestureRecognizers" destination="ova-Ov-OKv" appends="YES" id="cny-ko-F7z"/>
</connections>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="uOb-Wh-Ew6" firstAttribute="top" secondItem="LVW-zt-JUe" secondAttribute="bottom" constant="15" id="01E-pt-r18"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="top" secondItem="D1u-Lt-W0l" secondAttribute="top" constant="50" id="2Tm-qW-RZD"/>
<constraint firstAttribute="trailing" secondItem="LVW-zt-JUe" secondAttribute="trailing" id="B6e-nm-1KT"/>
<constraint firstAttribute="bottom" secondItem="uOb-Wh-Ew6" secondAttribute="bottom" constant="20" id="BW9-Uf-nL7"/>
<constraint firstAttribute="trailing" secondItem="uOb-Wh-Ew6" secondAttribute="trailing" constant="8" id="TRF-Oj-j11"/>
<constraint firstItem="LVW-zt-JUe" firstAttribute="leading" secondItem="D1u-Lt-W0l" secondAttribute="leading" id="ojo-i9-sB4"/>
<constraint firstItem="uOb-Wh-Ew6" firstAttribute="leading" secondItem="D1u-Lt-W0l" secondAttribute="leading" constant="8" id="yN9-W0-tng"/>
<constraint firstItem="WAn-22-dqH" firstAttribute="top" secondItem="D1u-Lt-W0l" secondAttribute="top" constant="50" id="2cQ-K4-UfR"/>
<constraint firstAttribute="trailing" secondItem="hd1-Nu-84c" secondAttribute="trailing" constant="8" id="68e-Oh-Cb5"/>
<constraint firstAttribute="trailing" secondItem="7ll-rV-5Xs" secondAttribute="trailing" id="88q-VP-QWQ"/>
<constraint firstItem="7ll-rV-5Xs" firstAttribute="top" secondItem="WAn-22-dqH" secondAttribute="bottom" constant="15" id="8i4-zf-oRn"/>
<constraint firstAttribute="trailing" secondItem="vZ9-hY-vNA" secondAttribute="trailing" constant="15" id="GYO-US-Els"/>
<constraint firstAttribute="bottom" secondItem="hd1-Nu-84c" secondAttribute="bottom" constant="100" id="IK7-6o-N1k"/>
<constraint firstItem="7ll-rV-5Xs" firstAttribute="leading" secondItem="D1u-Lt-W0l" secondAttribute="leading" id="XYL-JS-5tj"/>
<constraint firstItem="vZ9-hY-vNA" firstAttribute="top" secondItem="D1u-Lt-W0l" secondAttribute="top" constant="50" id="eaq-Xt-dkY"/>
<constraint firstItem="WAn-22-dqH" firstAttribute="leading" secondItem="D1u-Lt-W0l" secondAttribute="leading" constant="15" id="fKh-i7-Eox"/>
<constraint firstItem="hd1-Nu-84c" firstAttribute="leading" secondItem="D1u-Lt-W0l" secondAttribute="leading" constant="8" id="glX-Vf-zKe"/>
<constraint firstItem="hd1-Nu-84c" firstAttribute="top" secondItem="7ll-rV-5Xs" secondAttribute="bottom" constant="15" id="nsg-wE-fcO"/>
</constraints>
</view>
<blurEffect style="dark"/>
@ -1277,20 +1315,21 @@
</view>
<connections>
<outlet property="attachmentImageView" destination="LVW-zt-JUe" id="Nuk-39-At3"/>
<outlet property="statusLabel" destination="uOb-Wh-Ew6" id="ROf-CT-kTn"/>
<outlet property="attachmentScrollView" destination="7ll-rV-5Xs" id="3jL-0I-cSm"/>
<outlet property="statusTextView" destination="hd1-Nu-84c" id="5pl-oL-02x"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="YeS-EV-qHA" userLabel="First Responder" sceneMemberID="firstResponder"/>
<swipeGestureRecognizer direction="down" id="jGp-MJ-Wqo">
<tapGestureRecognizer id="9Gi-hE-TEp">
<connections>
<action selector="imageSwiped:" destination="N19-H3-zNH" id="v4O-q7-IMo"/>
<action selector="closeTapped:" destination="N19-H3-zNH" id="z4s-Ph-BbL"/>
</connections>
</swipeGestureRecognizer>
<swipeGestureRecognizer direction="up" id="d2a-nR-kSR">
</tapGestureRecognizer>
<tapGestureRecognizer id="ova-Ov-OKv">
<connections>
<action selector="imageSwiped:" destination="N19-H3-zNH" id="kqJ-JH-zff"/>
<action selector="shareTapped:" destination="N19-H3-zNH" id="aRW-QN-Jq4"/>
</connections>
</swipeGestureRecognizer>
</tapGestureRecognizer>
</objects>
<point key="canvasLocation" x="4365.6000000000004" y="-22.167487684729064"/>
</scene>
@ -1350,10 +1389,12 @@
<image name="Account" width="25" height="25"/>
<image name="Boost Regular" width="20" height="24"/>
<image name="Clock" width="22" height="22"/>
<image name="Close" width="20" height="20"/>
<image name="Globe" width="22" height="22"/>
<image name="Instance Placeholder" width="135" height="135"/>
<image name="Logo" width="400" height="400"/>
<image name="Logo" width="180" height="180"/>
<image name="Message" width="20" height="20"/>
<image name="Share" width="18" height="22"/>
<image name="Star Regular" width="22" height="22"/>
<image name="Timelines" width="20" height="21"/>
<namedColor name="Background Primary">
@ -1363,7 +1404,7 @@
<color red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="Secondary">
<color red="0.72941176470588232" green="0.6705882352941176" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.792156862745098" green="0.68627450980392157" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="Text">
<color red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

15
elpha-ios/StatusTableViewController.swift

@ -253,7 +253,7 @@ extension StatusTableViewController {
if let account = status.account {
cell.avatarImageView.af_setImage(withURL: account.avatarURL!, filter: avatarFilter)
cell.displayNameLabel.text = account.displayName
cell.usernameLabel.text = account.acct
cell.usernameLabel.text = "@\(account.acct!)"
}
}
@ -264,18 +264,7 @@ extension StatusTableViewController {
}
if let content = status.content {
do {
let styledContent = "<style>html * { font-size: 16px; color: #170C49; font-family: -apple-system } a:link { color: #8A7BAE } a:visited { color: #BAABD6 }</style> \(content)"
let attributedText = try NSAttributedString(
data: styledContent.data(using: String.Encoding.unicode, allowLossyConversion: true)!,
options: [.documentType: NSAttributedString.DocumentType.html],
documentAttributes: nil
)
cell.contentLabel.attributedText = attributedText
} catch {
print("\(error)")
}
cell.contentLabel.attributedText = content.htmlAttributed(size: 16)
}
cell.attachmentsView.backgroundColor = UIColor.white

15
elpha-ios/StatusView.swift

@ -231,7 +231,7 @@ class StatusView: UIView {
if let account = status.account {
avatarImageView.af_setImage(withURL: account.avatarURL!, filter: avatarFilter)
displayNameLabel.text = account.displayName
usernameLabel.text = account.acct
usernameLabel.text = "@\(account.acct!)"
}
if let attachments = status.attachments, attachments.count > 0 {
@ -240,14 +240,7 @@ class StatusView: UIView {
}
if let content = status.content {
// let linkAttributes: [NSAttributedString.Key : Any] = [
// NSAttributedString.Key.foregroundColor: UIColor(named: "Primary")!,
// NSAttributedString.Key.underlineColor: UIColor(named: "Primary")!,
// NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single,
// ]
contentTextView.attributedText = content.htmlAttributed(size: 15.0)
//contentTextView.linkTextAttributes = linkAttributes
if status.hidden && spoilerView == nil {
let spoilerText = UILabel(frame: contentTextView.frame)
@ -321,7 +314,7 @@ class StatusView: UIView {
if let account = status.account {
boostAvatarImageView.af_setImage(withURL: account.avatarURL!, filter: avatarFilter)
boostDisplayNameLabel.text = account.displayName
boostUsernameLabel.text = account.acct
boostUsernameLabel.text = "@\(account.acct!)"
}
updateStatusContent(reblog)
@ -329,7 +322,7 @@ class StatusView: UIView {
if let account = status.account {
avatarImageView.af_setImage(withURL: account.avatarURL!, filter: avatarFilter)
displayNameLabel.text = account.displayName
usernameLabel.text = account.acct
usernameLabel.text = "@\(account.acct!)"
}
updateStatusContent(status)
@ -340,7 +333,7 @@ class StatusView: UIView {
replyView.isHidden = false
replyAvatarImageView.af_setImage(withURL: replyAccount.avatarURL!, filter: avatarFilter)
replyDisplayNameLabel.text = replyAccount.displayName
replyUsernameLabel.text = replyAccount.acct
replyUsernameLabel.text = "@\(replyAccount.acct!)"
}
}
}

22
elpha-ios/StatusView.xib

@ -44,11 +44,11 @@
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="885"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="871"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="7Og-IU-seR">
<rect key="frame" x="0.0" y="20" width="375" height="865"/>
<rect key="frame" x="0.0" y="20" width="375" height="851"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bg1-Q4-Ru5">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
@ -224,7 +224,7 @@
</connections>
</view>
<view contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="cAR-YB-u2k">
<rect key="frame" x="0.0" y="255" width="375" height="130"/>
<rect key="frame" x="0.0" y="255" width="375" height="116"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="50m-cW-QIF">
<rect key="frame" x="0.0" y="8" width="367" height="70"/>
@ -266,8 +266,8 @@
<outletCollection property="gestureRecognizers" destination="13W-G2-Xm4" appends="YES" id="6RI-ff-czd"/>
</connections>
</view>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="top" scrollEnabled="NO" editable="NO" text="Content" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o7b-at-xQ9">
<rect key="frame" x="8" y="86" width="359" height="36"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="Content" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o7b-at-xQ9" customClass="UITextViewFixed" customModule="elpha_ios" customModuleProvider="target">
<rect key="frame" x="8" y="86" width="359" height="22"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Primary"/>
<color key="textColor" name="Text"/>
@ -292,14 +292,14 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XuS-iF-YYL">
<rect key="frame" x="0.0" y="385" width="375" height="375"/>
<rect key="frame" x="0.0" y="371" width="375" height="375"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" secondItem="XuS-iF-YYL" secondAttribute="height" multiplier="1:1" priority="999" id="8CQ-GM-Un6"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y5N-A7-27p">
<rect key="frame" x="0.0" y="760" width="375" height="50"/>
<rect key="frame" x="0.0" y="746" width="375" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pJk-g2-yyR">
<rect key="frame" x="8" y="10" width="155" height="30"/>
@ -454,7 +454,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0aT-X9-NYg">
<rect key="frame" x="0.0" y="810" width="375" height="50"/>
<rect key="frame" x="0.0" y="796" width="375" height="50"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Down" translatesAutoresizingMaskIntoConstraints="NO" id="zEk-jb-LHL">
<rect key="frame" x="15" y="15" width="20" height="20"/>
@ -484,7 +484,7 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m4t-ve-E78">
<rect key="frame" x="0.0" y="860" width="375" height="5"/>
<rect key="frame" x="0.0" y="846" width="375" height="5"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.93725490199999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="999" constant="5" id="QFa-Y9-r5a"/>
@ -508,7 +508,7 @@
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<point key="canvasLocation" x="53.600000000000001" y="146.17691154422789"/>
<point key="canvasLocation" x="53.600000000000001" y="139.880059970015"/>
</view>
<tapGestureRecognizer id="2h0-to-AXg">
<connections>
@ -569,7 +569,7 @@
<color red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="Secondary">
<color red="0.72941176470588232" green="0.6705882352941176" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.792156862745098" green="0.68627450980392157" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="Text">
<color red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

6
elpha-ios/String+HtmlAttributed.swift

@ -9,14 +9,16 @@
import UIKit
extension String {
func htmlAttributed(size: CGFloat, centered: Bool = false) -> NSAttributedString? {
func htmlAttributed(size: CGFloat, centered: Bool = false, color: UIColor? = nil) -> NSAttributedString? {
let color = color ?? UIColor(named: "Text")!
do {
let htmlString = """
<style>
html * {
font-family: -apple-system !important;
font-size: \(size)px !important;
color: \(UIColor(named: "Text")!.hexString()) !important;
color: \(color.hexString()) !important;
text-align: \(centered ? "center" : "initial") !important;
}
</style>

18
elpha-ios/UITextViewFixed.swift

@ -0,0 +1,18 @@
//
// UITextViewFixed.swift
// elpha-ios
//
// Created by Dwayne Harris on 11/6/18.
// Copyright © 2018 Elpha. All rights reserved.
//
import UIKit
@IBDesignable class UITextViewFixed: UITextView {
override func layoutSubviews() {
super.layoutSubviews()
textContainerInset = UIEdgeInsets.zero
textContainer.lineFragmentPadding = 0
}
}
Loading…
Cancel
Save