All Projects → tdscientist → Shelfview Ios

tdscientist / Shelfview Ios

Licence: mit
iOS custom view to display books on shelf

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Shelfview Ios

BetterBottomBar
Fork of the BottomNavigationView from the design lib to allow for view state, accessibility and colorful animations
Stars: ✭ 33 (-87.31%)
Mutual labels:  customview
ShaderView
ShaderView is an Android View that makes it easy to use GLSL shaders for your app. It's the modern way to use shaders for Android instead of RenderScript.
Stars: ✭ 53 (-79.62%)
Mutual labels:  customview
RotatableAutofitEditText
Extended EditText which allows to move, rotate and resize text at the same time
Stars: ✭ 51 (-80.38%)
Mutual labels:  customview
CustomWaterView
⭐ 仿支付宝蚂蚁森林效果
Stars: ✭ 118 (-54.62%)
Mutual labels:  customview
DottedView
Drawing Dots in android
Stars: ✭ 13 (-95%)
Mutual labels:  customview
MyView
一些杂七杂八的控件
Stars: ✭ 26 (-90%)
Mutual labels:  customview
BeautyClock
A simple project draw clock view by using Canvas and Kotlin
Stars: ✭ 14 (-94.62%)
Mutual labels:  customview
JQScrollNumberLabel
JQScrollNumberLabel:仿tumblr热度滚动数字条数, 一个显示数字的控件,当你改变其数字时,能够有滚动的动画,同时动画和位数可以限制,动态创建和实例化可选,字体样式自定义等。
Stars: ✭ 29 (-88.85%)
Mutual labels:  customview
ShowcaseView
ShowcaseView library for Android
Stars: ✭ 196 (-24.62%)
Mutual labels:  customview
JQFlowView
卡片式无限自动轮播图 ,无限/自动轮播,可自定义非当前显示view缩放和透明的特效等;喜欢❤️就star一下吧!
Stars: ✭ 24 (-90.77%)
Mutual labels:  customview
ComposableSweetToast
Jetpack Compose, Custom Toast, Solid Principles, Kotlin
Stars: ✭ 60 (-76.92%)
Mutual labels:  customview
double-avatar-view
Instagram-like double avatar view with cropping
Stars: ✭ 31 (-88.08%)
Mutual labels:  customview
SIRIWaveView
Siri like wave view for android
Stars: ✭ 65 (-75%)
Mutual labels:  customview
MultiShapeView
支持圆角矩形,圆形自定义View
Stars: ✭ 35 (-86.54%)
Mutual labels:  customview
MinTimetable
Customizable TimeTableView for Android
Stars: ✭ 26 (-90%)
Mutual labels:  customview
iMoney
iMoney 金融项目
Stars: ✭ 55 (-78.85%)
Mutual labels:  customview
PaperView
PaperView 是一个自定义的View,它就像一张纸折叠和展开
Stars: ✭ 26 (-90%)
Mutual labels:  customview
Circularprogressbar
A subclass of {android.view.View} class for creating a custom circular progressBar
Stars: ✭ 255 (-1.92%)
Mutual labels:  customview
CustomEditText
Simple Custom EditText for Android like Instagram
Stars: ✭ 23 (-91.15%)
Mutual labels:  customview
AndroidJoyStickView
This library lets you create joystick with some customization for android
Stars: ✭ 45 (-82.69%)
Mutual labels:  customview

ShelfView (iOS)

iOS custom view to display books on shelf (Android version is available here)

Requirements

  • iOS 10.0+
  • Swift 4.2

Installation

ShelfView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ShelfView'

Note

Because of book covers whose URLs are http, update your info.plist as follows:

  • add App Transport Security Settings to the list
  • add Allow Arbitrary Loads to the security settings added above; set it to YES.

Plain Shelf

import ShelfView

class PlainShelfController: UIViewController, PlainShelfViewDelegate {
    var shelfView: PlainShelfView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let books = [
            BookModel(bookCoverSource: "https://files.kerching.raywenderlich.com/covers/d5693015-46b6-44f8-bf7b-7a222b28d9fe.png",
                      bookId: "0",
                      bookTitle: "Realm: Building Modern Swift Apps with Realm"),
            BookModel(bookCoverSource: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTYEkCQ_wu8HoGJzzs_gUH_FVusgI2RhntBKQ-WkmqnDJZnriwY6Q",
                      bookId: "1",
                      bookTitle: "iOS 10 by Tutorials: Learning the new iOS APIs with Swift 3")
        ]        
        
        shelfView = PlainShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                                   bookModel: books, bookSource: PlainShelfView.BOOK_SOURCE_URL)

        shelfView.delegate = self
        self.view.addSubview(shelfView)
    }

    func onBookClicked(_ shelfView: PlainShelfView, index: Int, bookId: String, bookTitle: String) {
        print("I just clicked \"\(bookTitle)\" with bookId \(bookId), at index \(index)")
    }

}

Section Shelf

import ShelfView

class SectionShelfController: UIViewController, SectionShelfViewDelegate {
    var shelfView: SectionShelfView!

    override func viewDidLoad() {
        super.viewDidLoad()

        let books = [
            BookModel(bookCoverSource: "https://files.kerching.raywenderlich.com/covers/d5693015-46b6-44f8-bf7b-7a222b28d9fe.png",
                      bookId: "0",
                      bookTitle: "Realm: Building Modern Swift Apps with Realm"),
            BookModel(bookCoverSource: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTYEkCQ_wu8HoGJzzs_gUH_FVusgI2RhntBKQ-WkmqnDJZnriwY6Q",
                      bookId: "1",
                      bookTitle: "iOS 10 by Tutorials: Learning the new iOS APIs with Swift 3")
        ]
        let bookModelSectionArray = [BookModelSection(sectionName: "RAYWENDERLICH",
                                                      sectionId: "0",
                                                      sectionBooks: books)]

        shelfView = SectionShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                                     bookModelSection: bookModelSectionArray,
                                     bookSource: SectionShelfView.BOOK_SOURCE_URL)

        shelfView.delegate = self
        self.view.addSubview(shelfView)
    }

    func onBookClicked(_ shelfView: SectionShelfView, section: Int, index: Int,
                       sectionId: String, sectionTitle: String, bookId: String,
                       bookTitle: String) {
        print("I just clicked \"\(bookTitle)\" with bookId \(bookId), at index \(index). Section details --> section \(section), sectionId \(sectionId), sectionTitle \(sectionTitle)")
    }

}

Add more books to ShelfView

  • Plain Shelf
addBooks(bookModel: [BookModel])
  • Section Shelf
addBooks(bookModelSection: [BookModelSection])

Reload books on ShelfView

  • Plain Shelf
reloadBooks(bookModel: [BookModel])
  • Section Shelf
reloadBooks(bookModelSection: [BookModelSection])

Loading book covers from other sources

  • iPhone/iPad document directory
let books = [
    BookModel(bookCoverSource: "bookcover0.png", bookId: "0", bookTitle: "Book Title 0"),
    BookModel(bookCoverSource: "bookcover1.png", bookId: "1", bookTitle: "Book Title 1")
        ]
shelfView = PlainShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                           bookModel: books, bookSource: PlainShelfView.BOOK_SOURCE_DEVICE_DOCUMENTS)
  • iPhone/iPad library directory
let books = [
    BookModel(bookCoverSource: "bookcover0.png", bookId: "0", bookTitle: "Book Title 0"),
    BookModel(bookCoverSource: "bookcover1.png", bookId: "1", bookTitle: "Book Title 1")
        ]
shelfView = PlainShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                           bookModel: books, bookSource: PlainShelfView.BOOK_SOURCE_DEVICE_LIBRARY)
  • iPhone/iPad cache directory
let books = [
    BookModel(bookCoverSource: "bookcover0.png", bookId: "0", bookTitle: "Book Title 0"),
    BookModel(bookCoverSource: "bookcover1.png", bookId: "1", bookTitle: "Book Title 1")
        ]
shelfView = PlainShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                           bookModel: books, bookSource: PlainShelfView.BOOK_SOURCE_DEVICE_CACHE)
  • Directly from your project's source code
let books = [
    BookModel(bookCoverSource: "bookcover0.png", bookId: "0", bookTitle: "Book Title 0"),
    BookModel(bookCoverSource: "bookcover1.png", bookId: "1", bookTitle: "Book Title 1")
        ]
shelfView = PlainShelfView(frame: CGRect(x: 0, y: 0, width: 350, height: 500),
                           bookModel: books, bookSource: PlainShelfView.BOOK_SOURCE_RAW)

License

ShelfView is available under the MIT license. See the LICENSE file for more info.

Author

Adeyinka Adediji ([email protected])

Contributions & Bug Reporting

[email protected]

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].