All Projects → tarunon → Instantiate

tarunon / Instantiate

Licence: mit
Type-safe and constructor injectable InterfaceBuilder protocols.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Instantiate

Quinn
Async-friendly QUIC implementation in Rust
Stars: ✭ 1,859 (+1147.65%)
Mutual labels:  protocol
Jstp
Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF
Stars: ✭ 132 (-11.41%)
Mutual labels:  protocol
Dckit
Set of iOS controls with useful IBInspectable properties. Written on Swift.
Stars: ✭ 144 (-3.36%)
Mutual labels:  storyboard
Xib2storyboard
A tool to convert Xcode .xib to .storyboard files
Stars: ✭ 121 (-18.79%)
Mutual labels:  storyboard
Ruffles
Lightweight and fully managed reliable UDP library.
Stars: ✭ 131 (-12.08%)
Mutual labels:  protocol
Paper
Lightning Network Paper
Stars: ✭ 136 (-8.72%)
Mutual labels:  protocol
Go Gtp
GTP(GPRS Tunneling Protocol) implemented in pure Golang.
Stars: ✭ 116 (-22.15%)
Mutual labels:  protocol
Protocol
A protocol library for Minecraft Bedrock Edition
Stars: ✭ 147 (-1.34%)
Mutual labels:  protocol
Switch
💊 An iOS switch control implemented in Swift with full Interface Builder support
Stars: ✭ 132 (-11.41%)
Mutual labels:  storyboard
Abexpandableview
Expandable, collapsible, filterable and single/multi selectable table view.
Stars: ✭ 138 (-7.38%)
Mutual labels:  protocol
Type class
(Semi-)principled type classes for Elixir
Stars: ✭ 121 (-18.79%)
Mutual labels:  protocol
Ocaml Protoc
A Protobuf Compiler for OCaml
Stars: ✭ 129 (-13.42%)
Mutual labels:  protocol
Openvehiclediag
A rust based cross-platform ECU diagnostics and car hacking application, utilizing the passthru protocol
Stars: ✭ 135 (-9.4%)
Mutual labels:  protocol
Mangos V1
The pure golang implementation of nanomsg (version 1, frozen)
Stars: ✭ 1,533 (+928.86%)
Mutual labels:  protocol
Spec
[OLD!] RGB Protocol specifications for Bitcoin-based digital assets
Stars: ✭ 145 (-2.68%)
Mutual labels:  protocol
Javaosc
OSC content format/"protocol" library for JVM languages
Stars: ✭ 116 (-22.15%)
Mutual labels:  protocol
Appleapnpush
Send push notification to Apple Devices (iPhone, iPad)
Stars: ✭ 134 (-10.07%)
Mutual labels:  protocol
Api Guidelines
adidas group API design guidelines
Stars: ✭ 147 (-1.34%)
Mutual labels:  protocol
Go Mysqlstack
MySQL protocol library implementing in Go (golang)
Stars: ✭ 145 (-2.68%)
Mutual labels:  protocol
Node Lifx
Node.js implementation of the LIFX LAN protocol 💡
Stars: ✭ 137 (-8.05%)
Mutual labels:  protocol

Instantiate

Build Status Carthage compatible

Type-safe and constructor injectable InterfaceBuilder protocols.

Summary

Storyboard and Nib is not type safe, if you use UIStoryboard or UINib, your code would be get some gloom. Instantiate take type-safe protocols for Storyboard and Nib. Lets' improve our code with type-safe protocols!

as is

let storyboard = UIStoryboard(name: "ViewController", bundle: Bundle.main)
let vc = storyboard.instantiateInitialViewController() as! ViewController
vc.inject([1, 2, 3])

to be

import Instantiate
import InstantiateStandard
extension ViewController: StoryboardInstantiatable {}
let vc = ViewController(with: [1, 2, 3])

Protocols

StoryboardInstantiatable

Supports using viewController with Storyboard. Implement StoryboardInstantiatable at your viewController class, then you can use ViewController(with: Dependency).

NibInstantiatable

Supports using view with Nib. Implement NibInstantiatable at your view class, then you can use View(with: Dependency).

NibInstantiatableWrapper

Supports using view implements NibInstantiatable in other InterfaceBuilder. NibInstantiatableWrapper supports workaround. Make new UIView subclass, and implement NibInstantiatableWrapper, call loadView on init(coder:) and prepareForInterfaceBuilder. http://stackoverflow.com/questions/27807951/how-to-embed-a-custom-view-xib-in-a-storyboard-scene

Reusable

Supports UITableViewCell / UICollectionViewCell reuse features. Implement Reusable, then you can dequeue cell using Cell.dequeue(from: Parent, for: IndexPath, with: Dependency).

InstantiateStandard

StoryboardType and NibType required static var storyboard or static var nib. You need to write these values on own class, it is troublesome... Many developer define StoryboardName is same of ClassName, and if you are also, you can use InstantiateStandard. This libraly add default implementation of StoryboardType, NibType, and Reusable.

Instalation

Carthage

github "tarunon/Instantiate"

Pods

pod 'Instantiate'

Swift Package Manager

Select Xcode menu File > Swift Packages > Add Package Dependency... and enter repository URL with GUI.

Repository: https://github.com/tarunon/tarunon/Instantiate

Requirement

Platform Version
iOS 9.0+
macOS 10.11+
tvOS 9.0+
Swift 4.0+
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].