Skip to content

Commit 37995e7

Browse files
committed
Initial commit with actual code :)
1 parent a7e29b5 commit 37995e7

File tree

40 files changed

+1841
-85
lines changed

40 files changed

+1841
-85
lines changed

BSGridCollectionViewLayout.podspec

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,17 @@
1-
#
2-
# Be sure to run `pod lib lint BSGridCollectionViewLayout.podspec' to ensure this is a
3-
# valid spec before submitting.
4-
#
5-
# Any lines starting with a # are optional, but their use is encouraged
6-
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7-
#
8-
91
Pod::Spec.new do |s|
102
s.name = "BSGridCollectionViewLayout"
11-
s.version = "0.1.0"
12-
s.summary = "A short description of BSGridCollectionViewLayout."
13-
14-
# This description is used to generate tags and improve search results.
15-
# * Think: What does it do? Why did you write it? What is the focus?
16-
# * Try to keep it short, snappy and to the point.
17-
# * Write the description between the DESC delimiters below.
18-
# * Finally, don't worry about the indent, CocoaPods strips it!
3+
s.version = "1.0.0"
4+
s.summary = "Simple grid collection view layout."
195
s.description = <<-DESC
6+
A simple grid collection view layout. Displays multiple sections as one continuous grid without any section breaks.
207
DESC
218

22-
s.homepage = "https://github.com/<GITHUB_USERNAME>/BSGridCollectionViewLayout"
23-
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
9+
s.homepage = "https://github.com/mikaoj/BSGridCollectionViewLayout"
2410
s.license = 'MIT'
2511
s.author = { "Joakim Gyllstrom" => "[email protected]" }
26-
s.source = { :git => "https://github.com/<GITHUB_USERNAME>/BSGridCollectionViewLayout.git", :tag => s.version.to_s }
27-
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
28-
12+
s.source = { :git => "https://github.com/mikaoj/BSGridCollectionViewLayout.git", :tag => s.version.to_s }
2913
s.platform = :ios, '8.0'
3014
s.requires_arc = true
3115

3216
s.source_files = 'Pod/Classes/**/*'
33-
s.resource_bundles = {
34-
'BSGridCollectionViewLayout' => ['Pod/Assets/*.png']
35-
}
36-
37-
# s.public_header_files = 'Pod/Classes/**/*.h'
38-
# s.frameworks = 'UIKit', 'MapKit'
39-
# s.dependency 'AFNetworking', '~> 2.3'
4017
end

Example/BSGridCollectionViewLayout.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
607FACC81AFB9204008FA782 /* Project object */ = {
210210
isa = PBXProject;
211211
attributes = {
212+
LastSwiftUpdateCheck = 0710;
212213
LastUpgradeCheck = 0630;
213214
ORGANIZATIONNAME = CocoaPods;
214215
TargetAttributes = {

Example/BSGridCollectionViewLayout.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1+
// The MIT License (MIT)
12
//
2-
// AppDelegate.swift
3-
// BSGridCollectionViewLayout
3+
// Copyright (c) 2015 Joakim Gyllström
44
//
5-
// Created by Joakim Gyllstrom on 10/25/2015.
6-
// Copyright (c) 2015 Joakim Gyllstrom. All rights reserved.
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
711
//
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
822

923
import UIKit
1024

@@ -13,34 +27,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1327

1428
var window: UIWindow?
1529

16-
1730
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
1831
// Override point for customization after application launch.
1932
return true
2033
}
21-
22-
func applicationWillResignActive(application: UIApplication) {
23-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24-
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25-
}
26-
27-
func applicationDidEnterBackground(application: UIApplication) {
28-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29-
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30-
}
31-
32-
func applicationWillEnterForeground(application: UIApplication) {
33-
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34-
}
35-
36-
func applicationDidBecomeActive(application: UIApplication) {
37-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38-
}
39-
40-
func applicationWillTerminate(application: UIApplication) {
41-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42-
}
43-
44-
4534
}
4635

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="hOp-km-d5c">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
56
</dependencies>
67
<scenes>
78
<!--View Controller-->
8-
<scene sceneID="ufC-wZ-h7g">
9+
<scene sceneID="B7g-64-z5P">
910
<objects>
10-
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
11-
<layoutGuides>
12-
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
13-
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
14-
</layoutGuides>
15-
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
11+
<collectionViewController id="hOp-km-d5c" customClass="ViewController" customModule="BSGridCollectionViewLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
12+
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="5K5-Dv-cjD">
1613
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
17-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
19-
</view>
20-
</viewController>
21-
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
14+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
15+
<animations/>
16+
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="afM-xZ-uCG">
17+
<size key="itemSize" width="50" height="50"/>
18+
<size key="headerReferenceSize" width="0.0" height="0.0"/>
19+
<size key="footerReferenceSize" width="0.0" height="0.0"/>
20+
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
21+
</collectionViewFlowLayout>
22+
<cells>
23+
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="3kU-e0-XS7">
24+
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
25+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
26+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
27+
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
28+
<autoresizingMask key="autoresizingMask"/>
29+
<animations/>
30+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
31+
</view>
32+
<animations/>
33+
</collectionViewCell>
34+
</cells>
35+
<connections>
36+
<outlet property="dataSource" destination="hOp-km-d5c" id="Bkz-pb-HJr"/>
37+
<outlet property="delegate" destination="hOp-km-d5c" id="4N8-Fx-ZQ9"/>
38+
</connections>
39+
</collectionView>
40+
</collectionViewController>
41+
<placeholder placeholderIdentifier="IBFirstResponder" id="1KO-gT-Pdt" userLabel="First Responder" sceneMemberID="firstResponder"/>
2242
</objects>
43+
<point key="canvasLocation" x="210" y="354"/>
2344
</scene>
2445
</scenes>
2546
</document>
Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,66 @@
1+
// The MIT License (MIT)
12
//
2-
// ViewController.swift
3-
// BSGridCollectionViewLayout
3+
// Copyright (c) 2015 Joakim Gyllström
44
//
5-
// Created by Joakim Gyllstrom on 10/25/2015.
6-
// Copyright (c) 2015 Joakim Gyllstrom. All rights reserved.
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
711
//
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
822

923
import UIKit
24+
import BSGridCollectionViewLayout
1025

11-
class ViewController: UIViewController {
12-
26+
class ViewController: UICollectionViewController {
1327
override func viewDidLoad() {
1428
super.viewDidLoad()
15-
// Do any additional setup after loading the view, typically from a nib.
29+
30+
collectionView?.backgroundColor = UIColor.whiteColor()
31+
32+
let layout = GridCollectionViewLayout()
33+
layout.itemsPerRow = 3
34+
layout.itemSpacing = 2
35+
layout.itemHeightRatio = 3/4
36+
37+
collectionView?.collectionViewLayout = layout
38+
39+
collectionView?.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
1640
}
17-
18-
override func didReceiveMemoryWarning() {
19-
super.didReceiveMemoryWarning()
20-
// Dispose of any resources that can be recreated.
41+
42+
// MARK: Data source
43+
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
44+
return 2
45+
}
46+
47+
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
48+
if section == 0 {
49+
return 11
50+
} else {
51+
return 18
52+
}
53+
}
54+
55+
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
56+
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath)
57+
if indexPath.section == 0 {
58+
cell.backgroundColor = UIColor.blueColor()
59+
} else {
60+
cell.backgroundColor = UIColor.redColor()
61+
}
62+
63+
return cell
2164
}
22-
2365
}
2466

Example/Podfile.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
PODS:
2+
- BSGridCollectionViewLayout (1.0.0)
3+
4+
DEPENDENCIES:
5+
- BSGridCollectionViewLayout (from `../`)
6+
7+
EXTERNAL SOURCES:
8+
BSGridCollectionViewLayout:
9+
:path: "../"
10+
11+
SPEC CHECKSUMS:
12+
BSGridCollectionViewLayout: 9f24038e102ccb634dc514d4dbe59a7c18efd919
13+
14+
COCOAPODS: 0.39.0

Example/Pods/Local Podspecs/BSGridCollectionViewLayout.podspec.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)