Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linh-chu/LCUIComponents
It provides UI components such as popover, popup, dialog supporting iOS apps
https://github.com/linh-chu/LCUIComponents
Last synced: 15 days ago
JSON representation
It provides UI components such as popover, popup, dialog supporting iOS apps
- Host: GitHub
- URL: https://github.com/linh-chu/LCUIComponents
- Owner: linh-chu
- License: mit
- Created: 2017-05-26T04:22:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-01T22:55:22.000Z (about 7 years ago)
- Last Synced: 2024-05-29T04:51:07.099Z (7 months ago)
- Language: Swift
- Size: 2.11 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - LCUIComponents - A framework supports creating transient views on top of other content onscreen such as popover with a data list. (UI / Other Testing)
README
## Overview
LCUIComponents is an on-going project, which supports creating transient views appearing above other content onscreen when a control is selected. Currently, the framework provides supports to simply create a customisable popover with a selectable data list.
## Requirements
* iOS 8.0+
* Xcode 8+
* Swift 3## Usage
The following is an example of how to create a popover. For more advanced use please check out the `Sample` path.
### Set up a basic popover with data list
```swift
import LCUIComponents
import UIKitclass PopoverSamplesVC: UIViewController {
// Create a data source
let spiceList: [LCTuple] = [(key: 1, value:"Cinnamon"),
(key: 2, value:"Cloves"),
(key: 3, value:"Ginger"),
(key: 4, value:"Turmeric"),
(key: 5, value:"Tamarind")]
@IBAction func btnPopoverTapped(_ sender: UIButton) {
setupBasicPopover(for: sender)
}
func setupBasicPopover(for sender: UIView) {
// Init a popover with a callback closure after selecting data
let popover = LCPopover(for: sender, title: "Spices") { tuple in
// Use of the selected tuple
guard let value = tuple?.value else { return }
print(value)
}
// Assign data to the dataList
popover.dataList = spiceList
// Present the popover
present(popover, animated: true, completion: nil)
}
}
```
### Set up a custom popover with data list```swift
func setupCustomPopover(for sender: UIView) {
// Init a popover with a callback closure after selecting data
let popover = LCPopover(for: sender, title: "Spices") { tuple in
// Use of the selected tuple
guard let value = tuple?.value else { return }
print(value)
}
// Assign data to the dataList
popover.dataList = spiceList// Set popover properties
popover.size = CGSize(width: 250, height: 219)
popover.arrowDirection = .down
popover.backgroundColor = .orange
popover.borderColor = .orange
popover.borderWidth = 2
popover.barHeight = 44
popover.titleFont = UIFont.boldSystemFont(ofSize: 19)
popover.titleColor = .orange
popover.textFont = UIFont(name: "HelveticaNeue-MediumItalic", size: 17) ?? UIFont.systemFont(ofSize: 17)
popover.textColor = .black// Present the popover
present(popover, animated: true, completion: nil)
}
```## Installation
### CocoaPods
Specify LCUIComponents into your project's `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!pod 'LCUIComponents'
```### Manually Embedded
Simply download and add the `Popover.swift` file from `Source` path to your project.