Skip to content

Commit

Permalink
split last example of chapter 8 into two, one in Swift (prohibitively…
Browse files Browse the repository at this point in the history
… slow), one in Objective-C
  • Loading branch information
mattneub committed Jul 27, 2014
1 parent d9109de commit 8dddfa7
Show file tree
Hide file tree
Showing 141 changed files with 932 additions and 22 deletions.
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6185.11" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="0xu-nK-N1B">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6190.4"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="cCN-RP-8My">
<objects>
<collectionViewController autoresizesArchivedViewToFullSize="NO" id="HB2-Ma-jWh" customClass="ViewController" sceneMemberID="viewController">
<collectionView key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" minimumZoomScale="0.0" maximumZoomScale="0.0" dataMode="prototypes" id="LlB-UA-kWU">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewLayout key="collectionViewLayout" id="CSa-Tu-9qI" customClass="MyLayout"/>
<cells/>
<connections>
<outlet property="dataSource" destination="HB2-Ma-jWh" id="kls-ht-7Rp"/>
<outlet property="delegate" destination="HB2-Ma-jWh" id="iHs-Gu-0WL"/>
</connections>
</collectionView>
<navigationItem key="navigationItem" id="rNM-gj-q9Q"/>
<connections>
<segue destination="zGA-DZ-fGa" kind="push" identifier="push" id="46E-wl-2z6"/>
</connections>
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lxD-hh-m9y" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="720" y="107"/>
</scene>
<!--View Controller2-->
<scene sceneID="UjP-7S-lyn">
<objects>
<collectionViewController autoresizesArchivedViewToFullSize="NO" id="zGA-DZ-fGa" customClass="ViewController2" sceneMemberID="viewController">
<collectionView key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" minimumZoomScale="0.0" maximumZoomScale="0.0" dataMode="prototypes" id="Ca8-jF-93u">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="0.50196081400000003" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="wCz-is-5YI" customClass="MyFlowLayout">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells/>
<connections>
<outlet property="dataSource" destination="zGA-DZ-fGa" id="raD-Dt-jrc"/>
<outlet property="delegate" destination="zGA-DZ-fGa" id="iJz-9I-hV3"/>
</connections>
</collectionView>
<navigationItem key="navigationItem" id="OZT-eb-wqO"/>
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Wfp-Pf-RAK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1209" y="123"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="Jpu-E2-pFh">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="0xu-nK-N1B" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Dbt-l6-0GK">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="HB2-Ma-jWh" kind="relationship" relationship="rootViewController" id="xPG-ms-bBj"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dHG-P0-QBl" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="194" y="107"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4">
<size key="portraitSize" width="320" height="568"/>
<size key="landscapeSize" width="568" height="320"/>
</simulatedScreenMetrics>
</simulatedMetricsContainer>
</document>
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6185.11" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6190.4"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="c69-n7-Tbx" customClass="Cell">
<rect key="frame" x="0.0" y="0.0" width="246" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="246" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1VV-qg-y0Q">
<rect key="frame" x="0.0" y="0.0" width="246" height="50"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FVF-IM-x2t">
<rect key="frame" x="2" y="2" width="242" height="46"/>
<fontDescription key="fontDescription" name="GillSans-Bold" family="Gill Sans" pointSize="17"/>
<color key="textColor" red="0.0" green="1" blue="0.1426398754" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<color key="shadowColor" red="1" green="0.50196081400000003" blue="0.0" alpha="0.59999999999999998" colorSpace="calibratedRGB"/>
<size key="shadowOffset" width="2" height="2"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="FVF-IM-x2t" firstAttribute="top" secondItem="1VV-qg-y0Q" secondAttribute="top" constant="2" id="7SI-2i-Tv0"/>
<constraint firstItem="FVF-IM-x2t" firstAttribute="leading" secondItem="1VV-qg-y0Q" secondAttribute="leading" constant="2" id="DO8-WH-fLU"/>
<constraint firstAttribute="trailing" secondItem="FVF-IM-x2t" secondAttribute="trailing" constant="2" id="TEa-in-1ao"/>
<constraint firstAttribute="bottom" secondItem="FVF-IM-x2t" secondAttribute="bottom" constant="2" id="vhX-lP-Ut7"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="1VV-qg-y0Q" secondAttribute="trailing" id="K5z-7i-Uge"/>
<constraint firstItem="1VV-qg-y0Q" firstAttribute="leading" secondItem="c69-n7-Tbx" secondAttribute="leading" id="OJp-7Y-iMe"/>
<constraint firstAttribute="bottom" secondItem="1VV-qg-y0Q" secondAttribute="bottom" id="XJl-3z-MnA"/>
<constraint firstItem="1VV-qg-y0Q" firstAttribute="top" secondItem="c69-n7-Tbx" secondAttribute="top" id="ggF-qW-eaq"/>
</constraints>
<size key="customSize" width="246" height="50"/>
<connections>
<outlet property="container" destination="1VV-qg-y0Q" id="WYX-sC-E6q"/>
<outlet property="lab" destination="FVF-IM-x2t" id="iiY-dg-bso"/>
</connections>
</collectionViewCell>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4">
<size key="portraitSize" width="320" height="568"/>
<size key="landscapeSize" width="568" height="320"/>
</simulatedScreenMetrics>
</simulatedMetricsContainer>
</document>
@@ -1,5 +1,10 @@


/*
I've provided two independent versions of this example, one Swift, one Objective-C,
because the Swift version is prohibitively slow (especially on a device)
*/

#import "ViewController.h"
#import "Cell.h"

Expand Down
@@ -1,8 +1,7 @@

#import "ViewController2.h"
#import "Cell.h"
// #import "MyFlowLayout.h"
#import "ch21p748collectionViewLayoutFromScratch-Swift.h"
#import "MyFlowLayout.h"

@interface ViewController2 ()
@end
Expand Down

0 comments on commit 8dddfa7

Please sign in to comment.