Lang filter base setup

This commit is contained in:
Chris Li 2017-01-23 17:22:04 -05:00
parent 1a72bd0d14
commit 4663c1fc69
4 changed files with 95 additions and 1 deletions

View File

@ -111,6 +111,7 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! LibraryCollectionCell
let book = fetchedResultController.object(at: indexPath)
print(book.meta4URL)
cell.delegate = self
cell.imageView.image = UIImage(data: book.favIcon ?? Data())
cell.titleLabel.text = book.title

View File

@ -0,0 +1,23 @@
//
// LibraryLanguageController.swift
// Kiwix
//
// Created by Chris Li on 1/23/17.
// Copyright © 2017 Chris Li. All rights reserved.
//
import UIKit
class LibraryLanguageController: CoreDataTableBaseController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func dismissButtonTapped(_ sender: UIBarButtonItem) {
dismiss(animated: true, completion: nil)
}
}

View File

@ -170,7 +170,14 @@
<navigationItem key="navigationItem" id="sRt-4x-eGb">
<barButtonItem key="leftBarButtonItem" image="Cross" id="isr-wO-QO3">
<connections>
<action selector="dismissButtonTapped:" destination="cDq-va-k4I" id="gEj-c5-Tf4"/>
<action selector="dismissButtonTapped:" destination="cDq-va-k4I" id="RgX-lM-cfN"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" image="LanguageFilter" id="0v8-uV-zCG">
<connections>
<segue destination="9UV-8Y-ZY2" kind="popoverPresentation" popoverAnchorBarButtonItem="0v8-uV-zCG" id="PFl-Zb-f3y">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</barButtonItem>
</navigationItem>
@ -182,6 +189,46 @@
</objects>
<point key="canvasLocation" x="-173.59999999999999" y="-1395.6521739130435"/>
</scene>
<!--Library Language Controller-->
<scene sceneID="nQz-wd-Pht">
<objects>
<viewController id="AY1-gf-NdX" customClass="LibraryLanguageController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Gbe-6q-AdX"/>
<viewControllerLayoutGuide type="bottom" id="8vj-R1-8rW"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="mon-4F-A4S">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="28D-2G-Cvf">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="28D-2G-Cvf" firstAttribute="top" secondItem="mon-4F-A4S" secondAttribute="top" id="DJO-iO-hYh"/>
<constraint firstItem="28D-2G-Cvf" firstAttribute="leading" secondItem="mon-4F-A4S" secondAttribute="leading" id="E9e-XT-g3D"/>
<constraint firstItem="8vj-R1-8rW" firstAttribute="top" secondItem="28D-2G-Cvf" secondAttribute="bottom" id="pQ2-u7-NMz"/>
<constraint firstAttribute="trailing" secondItem="28D-2G-Cvf" secondAttribute="trailing" id="rLN-pb-zDN"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="vzE-Av-BsR">
<barButtonItem key="leftBarButtonItem" systemItem="done" id="OR7-vP-57g">
<connections>
<action selector="dismissButtonTapped:" destination="AY1-gf-NdX" id="PQe-Ul-pjG"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="tableView" destination="28D-2G-Cvf" id="wxf-wh-F7V"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="LO6-m0-Uxj" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1712.8" y="-1396.5517241379312"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="c2f-93-r3I">
<objects>
@ -238,9 +285,28 @@
</objects>
<point key="canvasLocation" x="-1112.8" y="-740.7796101949026"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="p9k-Dg-805">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="9UV-8Y-ZY2" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="R1C-h3-seO">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="AY1-gf-NdX" kind="relationship" relationship="rootViewController" id="sor-RY-jDf"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="VM9-Mm-1VF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="745" y="-1396"/>
</scene>
</scenes>
<resources>
<image name="Cross" width="16" height="16"/>
<image name="Dots" width="16" height="16"/>
<image name="LanguageFilter" width="16" height="16"/>
</resources>
</document>

View File

@ -11,6 +11,7 @@
9705D5941E368189005292AC /* Library.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9705D5931E368189005292AC /* Library.storyboard */; };
9705D5961E368712005292AC /* LibraryBooksController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9705D5951E368712005292AC /* LibraryBooksController.swift */; };
9705D5981E368933005292AC /* CoreDataCollectionBaseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9705D5971E368933005292AC /* CoreDataCollectionBaseController.swift */; };
9705D59A1E36B876005292AC /* LibraryLanguageController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9705D5991E36B876005292AC /* LibraryLanguageController.swift */; };
970A2A221DD562CB0078BB7C /* BookOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970A2A211DD562CB0078BB7C /* BookOperations.swift */; };
970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F731D9DB0FC00741290 /* 1.8.xcmappingmodel */; };
970E7F831DA0305000741290 /* WelcomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7F1DA0305000741290 /* WelcomeController.swift */; };
@ -162,6 +163,7 @@
9705D5931E368189005292AC /* Library.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Library.storyboard; sourceTree = "<group>"; };
9705D5951E368712005292AC /* LibraryBooksController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryBooksController.swift; sourceTree = "<group>"; };
9705D5971E368933005292AC /* CoreDataCollectionBaseController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataCollectionBaseController.swift; sourceTree = "<group>"; };
9705D5991E36B876005292AC /* LibraryLanguageController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryLanguageController.swift; sourceTree = "<group>"; };
970912551D7F452C00BBD5A1 /* 1.8.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = 1.8.xcdatamodel; sourceTree = "<group>"; };
970A2A211DD562CB0078BB7C /* BookOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookOperations.swift; sourceTree = "<group>"; };
970E7F731D9DB0FC00741290 /* 1.8.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; name = 1.8.xcmappingmodel; path = Kiwix/CoreData/Migration/1.8.xcmappingmodel; sourceTree = SOURCE_ROOT; };
@ -726,6 +728,7 @@
isa = PBXGroup;
children = (
9705D5951E368712005292AC /* LibraryBooksController.swift */,
9705D5991E36B876005292AC /* LibraryLanguageController.swift */,
);
path = Library;
sourceTree = "<group>";
@ -1099,6 +1102,7 @@
9705D5961E368712005292AC /* LibraryBooksController.swift in Sources */,
97D681391D6F711A00E5FA99 /* DownloadTask.swift in Sources */,
977B954D1DD4C40400F6F62B /* ScanLocalBook.swift in Sources */,
9705D59A1E36B876005292AC /* LibraryLanguageController.swift in Sources */,
97D681321D6F70EC00E5FA99 /* MigrationPolicy.swift in Sources */,
976C1DCB1E2FD5FC005EDEC4 /* TableOfContentsController.swift in Sources */,
976C1DD81E327328005EDEC4 /* FontSizeController.swift in Sources */,