A simple and elegant UIKit for iOS.

Overview

HamsterUIKit

A simple and elegant UIKit(Chart) for iOS, written in Swift.

Carthage compatible Platform Build Status

📊 Curve and bar Charts.
💡 Protocols are designed based on UIKit(UITableView).
🔟 Draw a complex but elegant graph in 10 minutes.

Protocols

Initialize and reload

UITableView HamsCurveChart HamsBarChart
init(frame: CGRect) same same
init?(coder aDecoder: NSCoder) same same
reloadData same same

DataSource

UITableView HamsCurveChart HamsBarChart
numberOfSections(in tableView: UITableView) -> Int numberOfCharts(in curveChart: HamsCurveChart) -> Int numberOfCharts(in barChart: HamsBarChart) -> Int
tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell curveChart(_ curveChart: HamsCurveChart, pointForChart indexPath: HamsIndexPath) -> HamsCurveChartPoint barChart(_ barChart: HamsBarChart, barForChart indexPath: HamsIndexPath) -> HamsBarChartRect
tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int curveChart(_ curveChart: HamsCurveChart, numberOfValuesInChart chart: Int) -> Int barChart(_ barChart: HamsBarChart, numberOfValuesInChart chart: Int) -> Int

Delegate

HamsCurveChart HamsBarChart
curveChart(_ curveChart: HamsCurveChart, configureForCharts chart: Int) barChart(_ barChart: HamsBarChart, configureForCharts chart: Int)

Installation

Carthage

github "Howardw3/HamsterUIKit"

CocoaPods

  1. Add to your Podfile:
use_frameworks!
pod 'HamsterUIKit'
  1. Type in terminal:
pod install
  1. Import the framework
import HamsterUIKit

Manually

git clone https://github.com/Haneke/HanekeSwift.git
  1. Copy and paste the above command in your terminal, it will clone the repo into your disk.
  2. Drag HamsterUIKit.xcodeproj to your project in the Project Navigator.
  3. Select your project and then your app target. Open the Build Phases panel.
  4. Expand the Target Dependencies group, and add HamsterUIKit.framework.
  5. Click on the + button at the top left of the panel and select New Copy Files Phase. Set Destination to Frameworks, and add HamsterUIKit.framework.
  6. import HamsterUIKit whenever you want to use Haneke.

Demo

Bar Chart Demo

Curve Chart Demo

Advanced Configuration

Bar Chart

Bar Chart Quick start

import UIKit
import HamsterUIKit

class HelloBarChartViewController: UIViewController, HamsBarChartDelegate, HamsBarChartDataSource {
	var barChart:HamsBarChart = HamsBarChart()
	var dataSets = [CGFloat]()
    override func viewDidLoad() {
        super.viewDidLoad()
		barChart = HamsBarChart(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 300))

		barChart.delegate = self
		barChart.dataSource = self
		view.addSubview(barChart)
    }

	func barChart(_ barChart: HamsBarChart, numberOfValuesInChart chart: Int) -> Int {
		return dataSets.count
	}

	func numberOfCharts(in barChart: HamsBarChart) -> Int {
		return 1
	}

	func barChart(_ barChart: HamsBarChart, barForChart indexPath: HamsIndexPath) -> HamsBarChartRect {
		let rect = HamsBarChartRect()
		rect.value = .plain(dataSets[indexPath.column])
		rect.color = .plain(.white)
		return rect
	}

	override func viewWillAppear(_ animated: Bool) {
		super.viewWillAppear(animated)
		dataSets = [1,4,6,1]
		barChart.reloadData()
	}

	func barChart(_ barChart: HamsBarChart, configureForCharts view: Int) {

		barChart.title = "BarChart(plain)"
	}
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

Todo

Advanced Configuration

Created By:

Howard Wang - Hire me

Zhiye Jin(UI Designer)

Healthy Fridge Project - Hamster Fridge Management

License

HamsterUIKit is Copyright (c) 2017 Howard Wang and released as open source under the attached Apache 2.0 license.

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 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.

You might also like...
Neumorphism framework for UIKit.
Neumorphism framework for UIKit.

NeumorphismKit is neumorphism framework for UIKit. Requirements iOS 12.0+ Swift 5.1+ Versions NeumorphismKit version Xcode version 1.0.0 Xcode 11+ 1.1

Easily use UIKit views in your SwiftUI applications. Create Xcode Previews for UIView elements
Easily use UIKit views in your SwiftUI applications. Create Xcode Previews for UIView elements

SwiftUIKitView Easily use UIKit views in SwiftUI. Convert UIView to SwiftUI View Create Xcode Previews from UIView elements SwiftUI functional updatin

Make ComposableArchitecture work with UIKit

ComposableUIKit The ComposableArchitecture (TCA) library provides a way of structuring Swift code with the Redux-pattern. It is highly optimized for S

Combine publisher bridges for UIKit
Combine publisher bridges for UIKit

Combine publisher bridges for UIKit

Swift extensions for UIKit.framework.

XUIKit Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation XUIKit is a

Example Catalyst app that is shown in a UIKit popover underneath an NSStatusItem
Example Catalyst app that is shown in a UIKit popover underneath an NSStatusItem

CatalystStatusItemPopoverExample Example Catalyst app that is shown in a UIKit popover underneath an NSStatusItem. References How to use macOS Specifi

Create descriptive UIKit screens, faster!
Create descriptive UIKit screens, faster!

Columbina's DeclarativeUIKit Create descriptive UIKit screens, faster! Get rid of constraints manipulation and use declarative language to create your

🎨 View instance initializing sugar for Swift & UIKit
🎨 View instance initializing sugar for Swift & UIKit

🎨 View instance initializing sugar for Swift & UIKit

xTensions is a collection of useful class extensions for UIKit.

xTensions Intro xTensions is a collection of useful class extensions for UIKit. Swift Package Manager Note: Instructions below are for using SwiftPM w

Releases(v1.0.1)
Owner
Howard Wang
Howard Wang
Creating a simple selectable tag view in SwiftUI is quite a challenge. here is a simple & elegant example of it.

SwiftUI TagView Creating a simple selectable tag view in SwiftUI is quite a challenge. here is a simple & elegant example of it. Usage: Just copy the

Ahmadreza 16 Dec 28, 2022
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

Features • Guides • Installation • Usage • Miscellaneous • Contributing ?? README is available in other languages: ???? . ???? . ???? . ???? . ???? To

Juanpe Catalán 11.7k Jan 6, 2023
UIAdapter - An elegant solution to the iOS screen adaptation problem

UIAdapter - An elegant solution to the iOS screen adaptation problem ???? 天朝子民 Features Numerical type fast conversion Storyboard equal scale adaptati

LEE 39 Dec 25, 2022
🚀 Elegant Pager View fully written in pure SwiftUI.

PagerTabStripView Made with ❤️ by Xmartlabs team. XLPagerTabStrip for SwiftUI! Introduction PagerTabStripView is the first pager view built in pure Sw

xmartlabs 482 Jan 9, 2023
FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView.

FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.

Wenchao Ding 6.7k Jan 2, 2023
ElongationPreview is an elegant UI push-pop style view controller

ElongationPreview is an elegant UI push-pop style view controller

Ramotion 886 Dec 19, 2022
Elegant Apply Style by Swift Method Chain.🌙

ApplyStyleKit ApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain. Normally, when applying styles to UIView etc.,it is n

shindyu 203 Nov 22, 2022
Convenient domain specific language for writing programmatic UI built over UIKit and more.

XYKit Swifty and convenient domain specific language for creating programmatic UI in a more declarative way and more than that. Built on top of UIKit

Denis Goloborodko 1 Nov 5, 2021
🎸🎸🎸 Common categories for daily development. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV and more.

?????? Common categories for daily development. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV and more.

77。 423 Jan 4, 2023
Application to test MVVM architecture with Combine and UIKit librarys.

Application to test MVVM architecture with Combine and UIKit librarys.

Jose Javier Escudero Gómez 0 Dec 14, 2021