• Stars
    star
    372
  • Rank 114,858 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight custom collection view inspired by Airbnb.

ASCollectionView CI Build Status CocoaPods Compatible Carthage Compatible Coverage Status Platform License

ASCollectionView

Lightweight custom collection view inspired by Airbnb.

Screenshots

portrait portrait_2 landscape

Requirements

ASCollectionView Version Minimum iOS Target Swift Version
1.4.0 10.0 5.x
1.1.0 9.0 4.2
1.0.9 9.0 4.1
1.0.8 9.0 4.0
1.0.7 9.0 3.x
1.0.2 8.0 2.x

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate ASCollectionView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'ASCollectionView', '1.4.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

brew update
brew install carthage

To integrate ASCollectionView into your Xcode project using Carthage, specify it in your Cartfile:

github "abdullahselek/ASCollectionView" ~> 1.4.0

Run carthage update to build the framework and drag the built ASCollectionView.framework into your Xcode project.

Swift Package Manager

Modify your Package.swift file to include the following dependency:

.package(url: "https://github.com/abdullahselek/ASCollectionView.git", from: "1.4.0")

Run swift package resolve

XCFramework

XCFrameworks require Xcode 11 or later and integration is very similar to integration of .framework format. Please use script scripts/build-framework.sh to generate binary ASCollectionView.xcframework archive that you can use as a dependency in Xcode.

ASCollectionView.xcframework is a Release (Optimized) binary that offer best available Swift code performance.

Example Usage

There is a sample viewcontroller inside demo folder and I added some sample code below.

You can add collectionview to your storyboard, xib file or add programmatically and then set constraints. Turn back to your viewcontroller and implement custom datasource and delegate methods.

class ViewController: UIViewController, ASCollectionViewDataSource, ASCollectionViewDelegate {
...

override func viewDidLoad() {
    super.viewDidLoad()
    collectionView.registerNib(UINib(nibName: collectionElementKindHeader, bundle: nil), forSupplementaryViewOfKind: collectionElementKindHeader, withReuseIdentifier: "header")
    collectionView.delegate = self
    collectionView.asDataSource = self
}

// MARK: ASCollectionViewDataSource

func numberOfItemsInASCollectionView(asCollectionView: ASCollectionView) -> Int {
    return numberOfItems
}

func collectionView(asCollectionView: ASCollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let gridCell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! GridCell
    gridCell.label.text = NSString(format: "Item %ld ", indexPath.row) as String
    gridCell.imageView.image = UIImage(named: NSString(format: "image-%ld", indexPath.row % 10) as String)
    return gridCell
}

func collectionView(asCollectionView: ASCollectionView, parallaxCellForItemAtIndexPath indexPath: NSIndexPath) -> ASCollectionViewParallaxCell {
    let parallaxCell = collectionView.dequeueReusableCellWithReuseIdentifier("parallaxCell", forIndexPath: indexPath) as! ParallaxCell
    parallaxCell.label.text = NSString(format: "Item %ld ", indexPath.row) as String
    parallaxCell.updateParallaxImage(UIImage(named: NSString(format: "image-%ld", indexPath.row % 10) as String)!)
    return parallaxCell
}

func collectionView(asCollectionView: ASCollectionView, headerAtIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
    let header = collectionView.dequeueReusableSupplementaryViewOfKind(ASCollectionViewElement.Header, withReuseIdentifier: "header", forIndexPath: indexPath)
    return header
}

func loadMoreInASCollectionView(asCollectionView: ASCollectionView) {
    if numberOfItems > 30 {
        collectionView.enableLoadMore = false
        return
    }
    numberOfItems += 10
    collectionView.loadingMore = false
    collectionView.reloadData()
}

GridCell collectionview cell used in sample

class GridCell: UICollectionViewCell {

    @IBOutlet var label: UILabel!
    @IBOutlet var imageView: UIImageView!

}

ParallaxCell used in sample

class ParallaxCell: ASCollectionViewParallaxCell {

	@IBOutlet var label: UILabel!

}

The MIT License (MIT)

Copyright (c) 2016 Abdullah Selek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Credits

Inspired by Airbnb and ninjaprox. Improved and all coded in new programming 
language Swift.

More Repositories

1

Swifty360Player

iOS 360-degree video player streaming from an AVPlayer.
Swift
178
star
2

HerePy

A library that provides a Python interface to the HERE location APIs.
Python
83
star
3

ViperC

Xcode template for VIPER Architecture for both Objective-C and Swift.
Objective-C
80
star
4

Merhaba

Bonjour networking for discovery and connection between iOS, macOS and tvOS devices.
Objective-C
72
star
5

SwiftyNotifications

Highly configurable iOS UIView for presenting notifications that doesn't block the UI.
Swift
65
star
6

SwiftyMessenger

Swift toolkit for passing messages between iOS apps and extensions.
Swift
61
star
7

plant-disease-classification-tf

Disease classification on different plants with using Machine Learning and Convolutional Neural Networks.
Python
60
star
8

Lighty

Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Swift
52
star
9

ASMapLauncher

ASMapLauncher is a library for iOS written in Swift that helps navigation with various mapping applications.
Swift
42
star
10

authenticatorpy

A Python library that provide unique keys for 2FA with given secret.
Python
41
star
11

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie.
Swift
37
star
12

WatchCon

WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.
Objective-C
34
star
13

ReducePy

URL shortener service using Tornado and Redis runs on Docker and Kubernetes.
Python
34
star
14

ASToast

A Swift extension for using Android style Toast notifications.
Swift
34
star
15

DragDropUI

A set of iOS UI components which have drag & drop capability.
Swift
30
star
16

spampy

Spam filtering module with Machine Learning using SVM (Support Vector Machines).
Python
29
star
17

ContactsWrapper

Contacts wrapper for iOS 9 or upper with Objective-C
Objective-C
22
star
18

koolsla

Food recommendation tool with Machine learning.
Python
21
star
19

plant-disease-classification-pytorch

Disease classification on different plants with using Machine Learning and Convolutional Neural Networks.
Python
18
star
20

go-here

Go client library around the HERE location based APIs.
Go
13
star
21

SwiftyProxyKit

Local HTTP Server for iOS and OS X that can be used as a proxy server.
Swift
12
star
22

plant-disease-classification

A Python module that classifies disease on plants.
Python
7
star
23

visionary

Various types of detection and tracking implementations with OpenCV and C++
C++
6
star
24

AES-Encryption

AES-Encryption is a Java class for encrypting and decrypting strings in Android with AES.
Java
5
star
25

ForceTouchActions

Objective-C wrapper for iOS Home Screen Quick Actions
Objective-C
4
star
26

plant-disease-classification-api

REST API for the classification of plant diseases.
Python
4
star
27

SwiftObfuscator

Secure your apps by obfuscating all the hard-coded security-sensitive strings.
Swift
3
star
28

SwiftPusher

OS X and iOS framework and application to play with the Apple Push Notification service (APNs).
Swift
3
star
29

plant-disease-classification-datasets

2
star
30

ASXTableViewController

An OS X control library written in Objective-C which enables easy to use NSTableView in Mac applications.
Objective-C
2
star
31

covid-19

Time Series Forecasting of COVID-19 using Recurrent Neural Networks.
Jupyter Notebook
2
star
32

plant-disease-classification-models

Trained models for plant-disease-classification Python library.
Python
1
star
33

plant-disease-classification-ui

Web application that enables plant disease classification.
Python
1
star
34

searching-techniques

Different searching techniques with Objective-C.
Objective-C
1
star
35

zipload

Download and extract zipped files
Ruby
1
star