Manos Chorianopoulos

redesign CouponViewController

Showing 20 changed files with 228 additions and 58 deletions
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>
......@@ -9,13 +9,18 @@ import UIKit
class CouponViewController: UIViewController {
@IBOutlet weak var mainView: UIView!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var scrollContentView: UIView!
@IBOutlet weak var couponImageHeight: NSLayoutConstraint!
@IBOutlet weak var redeemButton: UIButton!
@IBOutlet weak var termsLabel: UILabel!
@IBOutlet weak var termsButton: UIButton!
@IBOutlet weak var termsTextView: UITextView!
@IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
let uiscreen: CGRect = UIScreen.main.bounds
var termsVisible: Bool = false;
override func viewDidLoad() {
super.viewDidLoad()
......@@ -23,31 +28,55 @@ class CouponViewController: UIViewController {
setBackButton()
setNavigationTitle("Εκπτωτικό κουπόνι")
mainView.clipsToBounds = true
mainView.layer.cornerRadius = 30
mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
scrollView.clipsToBounds = true
scrollView.layer.cornerRadius = 30
scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
couponImageHeight.constant = self.uiscreen.height * 0.25
redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
termsLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium)
let tap = UITapGestureRecognizer(target: self, action: #selector(CouponViewController.termsTapFunction))
termsLabel.isUserInteractionEnabled = true
termsLabel.addGestureRecognizer(tap)
termsButton.titleLabel?.font = .systemFont(ofSize: 15.0, weight: .semibold)
// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
let htmlText = "<p>Το κουπόνι ισχύει έως 05/12/2022</p>\n"
termsTextView.attributedText = htmlText.htmlToAttributedString
termsTextView.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular)
termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00)
termsTextView.textAlignment = .center
termsTextView.isScrollEnabled = false
toggleTerms()
}
// MARK: - Functions
func toggleTerms() {
if (termsVisible) {
termsTextView.isHidden = false
let targetSize = CGSize(width: termsTextView.frame.width, height: CGFloat(MAXFLOAT))
termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height
// MARK: - Actions
termsButton.setImage(UIImage(named: "ic_up_dark.png"), for: .normal)
} else {
termsTextView.isHidden = true
termsTextViewHeight.constant = CGFloat(0)
@objc func termsTapFunction(sender:UITapGestureRecognizer) {
print("Terms tapped!")
termsButton.setImage(UIImage(named: "ic_down_dark.png"), for: .normal)
}
}
// MARK: - Actions
@IBAction func redeemButtomAction(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func termsButtonAction(_ sender: Any) {
termsVisible = !termsVisible
toggleTerms()
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -173,13 +173,16 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jqu-cp-CWU">
<rect key="frame" x="0.0" y="54" width="414" height="842"/>
<rect key="frame" x="0.0" y="44" width="414" height="852"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_white" translatesAutoresizingMaskIntoConstraints="NO" id="Oep-XD-blB">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
</imageView>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1N5-oA-ZTb">
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<rect key="frame" x="0.0" y="5" width="414" height="847"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uTN-Qr-wBi">
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3SX-fR-ph2">
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
......@@ -187,68 +190,84 @@
<constraint firstAttribute="height" constant="200" id="zUx-Yd-in7"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="isU-Qv-94G">
<rect key="frame" x="20" y="230" width="341" height="38.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="isU-Qv-94G">
<rect key="frame" x="20" y="230" width="374" height="38.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="0.84705882352941175" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSA-lM-N5v">
<rect key="frame" x="20" y="298.5" width="361.5" height="50.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSA-lM-N5v">
<rect key="frame" x="20" y="293.5" width="374" height="57.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg">
<rect key="frame" x="30" y="716" width="354" height="50"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg">
<rect key="frame" x="83" y="451" width="248" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="n2w-Tx-hhO"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Κάντο δώρο!">
<backgroundConfiguration key="background" cornerRadius="7">
<buttonConfiguration key="configuration" style="plain" title="Απόκτησέ το">
<backgroundConfiguration key="background" cornerRadius="12">
<color key="backgroundColor" red="0.47450980390000003" green="0.74901960779999999" blue="0.078431372550000003" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
</backgroundConfiguration>
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="15"/>
<color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration>
<connections>
<action selector="redeemButtomAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="ygO-66-Dsl"/>
<action selector="redeemButtomAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="W1u-Fc-1nm"/>
</connections>
</button>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Wc-e3-KgW">
<rect key="frame" x="20" y="796" width="374" height="16"/>
<attributedString key="attributedText">
<fragment content="Όροι χρήσης">
<attributes>
<color key="NSColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<font key="NSFont" metaFont="system" size="14"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
<integer key="NSUnderline" value="1"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KvN-fk-rlm">
<rect key="frame" x="103.5" y="511" width="207" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="O7T-ug-rTB"/>
</constraints>
<inset key="imageEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" image="ic_down_dark" imagePlacement="trailing" title="Όροι χρήσης" imagePadding="5">
<preferredSymbolConfiguration key="preferredSymbolConfigurationForImage"/>
<fontDescription key="titleFontDescription" type="system" weight="semibold" pointSize="15"/>
<color key="baseForegroundColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
</buttonConfiguration>
<connections>
<action selector="termsButtonAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="Cdz-mV-gqb"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="siA-c8-Ub8">
<rect key="frame" x="20" y="571" width="374" height="0.0"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" id="BWJ-i6-UeO"/>
</constraints>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="KvN-fk-rlm" secondAttribute="bottom" constant="30" id="2Md-hq-rQl"/>
<constraint firstItem="KvN-fk-rlm" firstAttribute="width" secondItem="uTN-Qr-wBi" secondAttribute="width" multiplier="0.5" id="2R9-MN-w6g"/>
<constraint firstItem="dSA-lM-N5v" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="6B9-Tx-YcO"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/>
<constraint firstItem="9Wc-e3-KgW" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="91Z-y9-N6s"/>
<constraint firstItem="FCd-hv-dHg" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="30" id="DYG-XQ-tco"/>
<constraint firstAttribute="trailing" secondItem="FCd-hv-dHg" secondAttribute="trailing" constant="30" id="KJ4-Vf-6ti"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dSA-lM-N5v" secondAttribute="trailing" constant="20" id="LZq-UM-EE3"/>
<constraint firstAttribute="trailing" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/>
<constraint firstAttribute="trailing" secondItem="siA-c8-Ub8" secondAttribute="trailing" constant="20" id="C8g-1f-Ef3"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="siA-c8-Ub8" secondAttribute="bottom" constant="30" id="FOo-d7-zvC"/>
<constraint firstAttribute="trailing" secondItem="dSA-lM-N5v" secondAttribute="trailing" constant="20" id="LZq-UM-EE3"/>
<constraint firstItem="siA-c8-Ub8" firstAttribute="top" secondItem="KvN-fk-rlm" secondAttribute="bottom" constant="10" id="MHv-4j-YYr"/>
<constraint firstItem="FCd-hv-dHg" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="OFE-Xc-Ui3"/>
<constraint firstItem="isU-Qv-94G" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="PR6-tJ-tw0"/>
<constraint firstItem="KvN-fk-rlm" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="QQN-Ps-Th4"/>
<constraint firstAttribute="trailing" secondItem="3SX-fR-ph2" secondAttribute="trailing" id="WJj-1Q-Erx"/>
<constraint firstAttribute="bottom" secondItem="9Wc-e3-KgW" secondAttribute="bottom" constant="30" id="dJ7-Kz-ne0"/>
<constraint firstItem="9Wc-e3-KgW" firstAttribute="top" secondItem="FCd-hv-dHg" secondAttribute="bottom" constant="30" id="dTv-Rx-rpW"/>
<constraint firstItem="dSA-lM-N5v" firstAttribute="top" secondItem="isU-Qv-94G" secondAttribute="bottom" constant="30" id="k8m-Rf-p7u"/>
<constraint firstItem="siA-c8-Ub8" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="cpX-xa-q0z"/>
<constraint firstItem="KvN-fk-rlm" firstAttribute="top" secondItem="FCd-hv-dHg" secondAttribute="bottom" constant="10" id="fAV-Vc-ICH"/>
<constraint firstItem="dSA-lM-N5v" firstAttribute="top" secondItem="isU-Qv-94G" secondAttribute="bottom" constant="25" id="k8m-Rf-p7u"/>
<constraint firstItem="3SX-fR-ph2" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" id="nBV-nm-wOq"/>
<constraint firstAttribute="trailing" secondItem="9Wc-e3-KgW" secondAttribute="trailing" constant="20" id="nsf-fZ-63s"/>
<constraint firstItem="3SX-fR-ph2" firstAttribute="top" secondItem="uTN-Qr-wBi" secondAttribute="top" id="oaX-KH-TEh"/>
<constraint firstItem="isU-Qv-94G" firstAttribute="top" secondItem="3SX-fR-ph2" secondAttribute="bottom" constant="30" id="vQf-lC-GgG"/>
<constraint firstItem="FCd-hv-dHg" firstAttribute="top" relation="greaterThanOrEqual" secondItem="dSA-lM-N5v" secondAttribute="bottom" constant="60" id="x3c-xH-QFZ"/>
<constraint firstItem="FCd-hv-dHg" firstAttribute="top" secondItem="dSA-lM-N5v" secondAttribute="bottom" constant="100" id="x3c-xH-QFZ"/>
<constraint firstItem="FCd-hv-dHg" firstAttribute="width" secondItem="uTN-Qr-wBi" secondAttribute="width" multiplier="0.6" id="xPb-wH-vOl"/>
</constraints>
</view>
</subviews>
......@@ -266,10 +285,14 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="1N5-oA-ZTb" firstAttribute="leading" secondItem="Jqu-cp-CWU" secondAttribute="leading" id="6xu-Fr-ayy"/>
<constraint firstItem="Oep-XD-blB" firstAttribute="leading" secondItem="Jqu-cp-CWU" secondAttribute="leading" id="EcY-pv-yN5"/>
<constraint firstItem="uTN-Qr-wBi" firstAttribute="height" relation="greaterThanOrEqual" secondItem="Jqu-cp-CWU" secondAttribute="height" id="IW1-Sy-djh"/>
<constraint firstItem="Oep-XD-blB" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" id="Ykm-QS-49G"/>
<constraint firstAttribute="trailing" secondItem="1N5-oA-ZTb" secondAttribute="trailing" id="dQR-wy-Qcd"/>
<constraint firstItem="1N5-oA-ZTb" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" id="g8J-5T-9Mg"/>
<constraint firstItem="1N5-oA-ZTb" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" constant="5" id="g8J-5T-9Mg"/>
<constraint firstAttribute="bottom" secondItem="1N5-oA-ZTb" secondAttribute="bottom" id="kaG-d8-5oJ"/>
<constraint firstAttribute="bottom" secondItem="Oep-XD-blB" secondAttribute="bottom" id="kkx-h0-joG"/>
<constraint firstAttribute="trailing" secondItem="Oep-XD-blB" secondAttribute="trailing" id="xnN-ZO-lA9"/>
</constraints>
</view>
</subviews>
......@@ -277,17 +300,20 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="Jqu-cp-CWU" secondAttribute="bottom" id="ANm-zp-vX6"/>
<constraint firstItem="Jqu-cp-CWU" firstAttribute="top" secondItem="JM4-xN-bgp" secondAttribute="topMargin" constant="10" id="ST9-WE-ewd"/>
<constraint firstItem="Jqu-cp-CWU" firstAttribute="top" secondItem="TUZ-8z-puM" secondAttribute="top" id="ST9-WE-ewd"/>
<constraint firstAttribute="trailing" secondItem="Jqu-cp-CWU" secondAttribute="trailing" id="eQx-vL-Dfd"/>
<constraint firstItem="Jqu-cp-CWU" firstAttribute="leading" secondItem="JM4-xN-bgp" secondAttribute="leading" id="kQx-xb-czQ"/>
</constraints>
</view>
<connections>
<outlet property="couponImageHeight" destination="zUx-Yd-in7" id="NWw-aF-GEM"/>
<outlet property="mainView" destination="Jqu-cp-CWU" id="cLA-eX-Av4"/>
<outlet property="redeemButton" destination="FCd-hv-dHg" id="blu-64-lZt"/>
<outlet property="scrollContentView" destination="uTN-Qr-wBi" id="atF-nT-J6Y"/>
<outlet property="termsLabel" destination="9Wc-e3-KgW" id="2Z0-nm-mAy"/>
<outlet property="couponImageHeight" destination="zUx-Yd-in7" id="7vo-8L-d8o"/>
<outlet property="mainView" destination="Jqu-cp-CWU" id="Q0Z-dO-MXL"/>
<outlet property="redeemButton" destination="FCd-hv-dHg" id="3Jw-Yn-uNr"/>
<outlet property="scrollContentView" destination="uTN-Qr-wBi" id="pPq-Lh-qVN"/>
<outlet property="scrollView" destination="1N5-oA-ZTb" id="qee-AV-Oev"/>
<outlet property="termsButton" destination="KvN-fk-rlm" id="pj7-bA-bhe"/>
<outlet property="termsTextView" destination="siA-c8-Ub8" id="EfZ-wm-ED6"/>
<outlet property="termsTextViewHeight" destination="BWJ-i6-UeO" id="GHO-YH-B9e"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zFf-Es-4zg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
......@@ -341,6 +367,8 @@
</scenes>
<resources>
<image name="coupons_scrollview" width="214" height="463.5"/>
<image name="coupons_scrollview_white" width="214" height="462"/>
<image name="ic_down_dark" width="22" height="11.5"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
......
{
"images" : [
{
"filename" : "coupons_scrollview_white.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "coupons_scrollview_white-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "coupons_scrollview_white-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_down_dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_down_dark-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_down_dark-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_up_dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_up_dark-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_up_dark-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -49,3 +49,17 @@ extension UIViewController {
}
}
extension String {
var htmlToAttributedString: NSAttributedString? {
guard let data = data(using: .utf8) else { return nil }
do {
return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)
} catch {
return nil
}
}
var htmlToString: String {
return htmlToAttributedString?.string ?? ""
}
}
......
......@@ -75,6 +75,7 @@ public class swiftApi {
public let inner_text: String?
public let buyable: Bool?
public let visible: Bool?
public let terms: String?
public init(dictionary: [String: Any]) {
self.uuid = dictionary["uuid"] as? String? ?? ""
......@@ -88,6 +89,7 @@ public class swiftApi {
self.inner_text = dictionary["inner_text"] as? String? ?? ""
self.buyable = dictionary["buyable"] as? Bool? ?? false
self.visible = dictionary["visible"] as? Bool? ?? false
self.terms = dictionary["terms"] as? String? ?? ""
let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""]
let expirationString = expirationObject?["value"] as? String? ?? ""
......