Code Monkey home page Code Monkey logo

reactant's Introduction

IMPORTANT: This project is currently under heavy development and the API is not stable and might change with upcoming versions. Once beta is released, the API is considered stable and shouldn't change change unless some critical bug is found, which fixing would mean changing the API.

Torch logo

Current status:
Build Status

Support this project using Flattr:
Flattr this git repo

Torch is an Open Source library that makes data storage on Android easy.


Development of Torch ORM is sponsored by Brightify

githalytics.com alpha

reactant's People

Contributors

filipdolnik avatar marekslk avatar matoushybl avatar matyaskriz avatar raulbatista94 avatar rkrenecky avatar tadeaskriz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactant's Issues

ControllerRootViewContainer could be typed.

The implementation could be like this:

public final class TypedControllerRootViewContainer<CONTROLLER>: ControllerRootViewContainer

public class ControllerRootViewContainer: UIView, Configurable

It would allow switching in styles in Configuration like this:

controllerRoot = { view in
    if view is TypedControllerRootViewContainer<LoginController> { ... }
}

Add an options parameter to the `PlainTableView` initializer.

This OptionSet parameter will allow for shared options (if, in the future, there are added more options to the initializer, this is reasonable) and easier initializing, compare:

let tableView = PlainTableView<FiendCell>(reloadable: false, automaticallyDeselects: false, swipeToRemove: true)

to

let tableView = PlainTableView<FriendCell>(options: [.reloadable, .toggleSelection, .swipable])

Another plus is that some libraries have quite customizable initializers that contain lots of Bool parameters, some with default values, but when you want to only use it for a simple task, going through the init can be quite tedious. Luckily, we aren't at that stage, yet, but when we get there, it's going to be too late because it would break too much code.

The downside is that I don't think you can have any default parameters with OptionSets. I mean yeah, you can set them but if the user wishes to turn off the default option, it would require an anti-option that would counter the normal one. Not sure if there's any other way.

Android support

Supper excited about Reactant. Is there any plan to add android support?

Highlight in TableViewCells doesn't work

Problem is in TableViewCellWrapper.swift:

    public override func setHighlighted(_ highlighted: Bool, animated: Bool) {
        tableViewCell?.setHighlighted(isSelected, animated: animated)
    }

there should be highlighted instead of isSelected.

Add method for removing all views from a superview.

This is quite useful when working with our stack and UIStackView.

extension UIView {
    @discardableResult
    public func removeSubviews() -> [UIView] {
        let subviews = self.subviews
        for subview in subviews {
            subview.removeFromSuperview()
        }

        return subviews
    }
}

Make UINavigationController implement DialogDismissalListener

This is needed to make the listener work when presenting from navigation, but expecting result in controller presented in UINavigationController.

extension UINavigationController: DialogDismissalListener {

    public func dialogWillDismiss() {
        if let listener = topViewController as? DialogDismissalListener {
            listener.dialogWillDismiss()
        }
    }

    public func dialogDidDismiss() {
        if let listener = topViewController as? DialogDismissalListener {
            listener.dialogDidDismiss()
        }
    }
}

Let's add system font support

import UIKit

public extension UIFont {
    public enum System {
        case ultraLight
        case thin
        case light
        case regular
        case medium
        case semibold
        case bold
        case heavy
        case black

        private var weight: CGFloat {
            switch self {
            case .ultraLight:
                return UIFontWeightUltraLight
            case .thin:
                return UIFontWeightThin
            case .light:
                return UIFontWeightLight
            case .regular:
                return UIFontWeightRegular
            case .medium:
                return UIFontWeightMedium
            case .semibold:
                return UIFontWeightSemibold
            case .bold:
                return UIFontWeightBold
            case .heavy:
                return UIFontWeightHeavy
            case .black:
                return UIFontWeightBlack
            }
        }

        public subscript(size: CGFloat) -> UIFont {
            return font(size: size)
        }

        public func font(size: CGFloat) -> UIFont {
            return UIFont.systemFont(ofSize: size, weight: weight)
        }
    }
}

public extension UIFont {

    public func smallCapitals() -> UIFont {
        let settings = [
            [UIFontFeatureTypeIdentifierKey: kLowerCaseType,
             UIFontFeatureSelectorIdentifierKey: kLowerCaseSmallCapsSelector],
            [UIFontFeatureTypeIdentifierKey: kNumberCaseType,
             UIFontFeatureSelectorIdentifierKey: kUpperCaseNumbersSelector]]
        let attributes: [String: Any] = [UIFontDescriptorFeatureSettingsAttribute: settings, UIFontDescriptorNameAttribute: fontName]
        return UIFont(descriptor: UIFontDescriptor(fontAttributes: attributes), size: pointSize)
    }
}

public extension UIFont {

    public func with(traits: UIFontDescriptorSymbolicTraits...) -> UIFont {
        let descriptor = fontDescriptor.withSymbolicTraits(UIFontDescriptorSymbolicTraits(traits))!
        return UIFont(descriptor: descriptor, size: 0)
    }

    public func italic() -> UIFont {
        return with(traits: .traitItalic)
    }
}

Add typealias for `Observable`

When overriding actions in ViewBase error occurs and compiler informs that "Property does not override any property from its superclass" unless RxSwift is imported. It would be nice to solve it by adding a typealias for Observable.

Possible code duplication?

At ComponentDelegate.swift:84 we have this:

public weak var ownerComponent: COMPONENT? {
    didSet {
        needsUpdate = stateStorage != nil
    }
}

If I understand the implementation correctly, we want to set needsUpdate to true if the component has a componentState, why isn't then this variable used?

public var hasComponentState: Bool {
    return stateStorage != nil
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.