Giter VIP home page Giter VIP logo

few.swift's People

Contributors

adlai-holler avatar joshaber 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  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

few.swift's Issues

Add instructions in README on how to edit demo

Not sure if it has just been a long week but I'm struggling to get the demo iOS project to update rebuild a framework of my changes ๐Ÿ˜ฌ

It looks like it is looking for the Few.framework in a build/Debug-iphoneos directory but that does not exist. I have tried building/running/archiving the framework targets and no frameworks get put there. Is there something I am missing?

Installation documentation?

Some additional documentation on how to download, install, and run the project would be nice. Plus the same on including Few in my own project.

Nesting and flexbox

If I create a root app component with 2 child components, those components flexbox layouts are computed first as independent flexbox layout calls and not as children of the app component's layout. In my case that means they receive no width. If instead I wrap them in Elements that are children of the app component it works as expected. Is this by design? Do I need to create wrapping elements around components to handle certain layout cases?

Use flexbox terminology

We use flexbox for layout but different terminology. We should use the same so it's easy to share existing knowledge and resources.

This'll obviously require changes to SwiftBox.

AsyncDisplayKit

It's pretty excellent, and it's just begging for a React-style API. Few can make this happen. @joshaber Any interest?

Is this dead?

No commits in 2 years. I'm guessing this is dead, right?

Multithreading?

Should we allow component state to be changed from a background thread? Should it do realization, layout, or diffing on a background thread?

Less terrible layout

Currently it's really just setting frames like the Bad Old Days. It'd be nice if it were nicer.

How to have overlapping elements?

Hi, I'm trying to create a cell that looks like

few-layered-cell-example

and I need some help getting the small circle into position. Could someone point me in the right direction?

[RFC] Use ComponentSpec as api for defining components

Because Swift currently does not support non-generic subclasses, i thought about creating components by implementing a ComponentSpec or ComponentType protocol. We can use associated types to infer the state type. We only need to know when the state changes, maybe we can make a State type that you can observe.

After implementing ComponentSpec you can use the method construct to create a Component<Spec.StateType>

To receive lifecycle events we could add an LifeCycleEvent enum, and add lifeCycleStateChanged(event: LifeCycleEvent) for receiving those events.

Carthage install issue on Xcode 7.1?

I'm trying to install Few.swift via Carthage and I'm running into some xcodebuild issues. I'm on Xcode 7.1 (7B91b).

Here's my Cartfile:

github "joshaber/Few.swift" "swift-2"

Here's the output when building iOS:

carthage update --platform iOS
*** Fetching Few.swift
*** Fetching SwiftBox
*** Checking out SwiftBox at "c316daebb98237a0c20c5fc7cb92028f44809861"
*** Checking out Few.swift at "12406946e2b11b3f0848235544ff6aaf97618f6b"
*** xcodebuild output can be found in /var/folders/s6/qx12s0856zg2zhsnx_14sqd40000gn/T/carthage-xcodebuild.ZyIMzF.log
*** Building scheme "SwiftBox-iOS" in SwiftBox.xcodeproj
*** Building scheme "Few-iOS" in Few.xcworkspace
** BUILD FAILED **


The following build commands failed:
        CompileSwift normal x86_64 /Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
/Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift:69:234: error: type 'Direction' has no member 'Row'
A shell task failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
        CompileSwift normal x86_64 /Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

And here's the output when I build for Mac:

โ†’ carthage update --platform Mac
*** Fetching Few.swift
*** Fetching SwiftBox
*** Checking out SwiftBox at "c316daebb98237a0c20c5fc7cb92028f44809861"
*** Checking out Few.swift at "12406946e2b11b3f0848235544ff6aaf97618f6b"
*** xcodebuild output can be found in /var/folders/s6/qx12s0856zg2zhsnx_14sqd40000gn/T/carthage-xcodebuild.lbVR1l.log
*** Building scheme "SwiftBox-Mac" in SwiftBox.xcodeproj
*** Building scheme "Few-Mac" in Few.xcworkspace
** BUILD FAILED **


The following build commands failed:
        CompileSwift normal x86_64 /Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
/Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift:39:21: error: type of expression is ambiguous without more context
/Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift:69:234: error: type 'Direction' has no member 'Row'
A shell task failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
        CompileSwift normal x86_64 /Users/mark/projects/foo/Carthage/Checkouts/Few.swift/FewCore/Element.swift
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

FWIW In Carthage/Checkouts/SwiftBox/SwiftBox/Node.swift, I see this:

public enum Direction: UInt32 {
    case Inherit = 0
    case LeftToRight = 1
    case RightToLeft = 2
}

No idea if that's the enum it's looking at, but if it is it certainly doesn't have a Row member.

Is there some mismatch between Few.swift and Swiftbox going on? Some kind of Cartfile confusion or something? Admittedly, I have never used either of these libraries, so I'm exactly sure what I'm looking at. This library looks great - I've got a prototype build of a Redux Swift implementation and would love to hook it up with Few.swift.

Thoughts?

Add `didRealize` hook to Component

@joshaber Sometimes it would be nice to be able to customize a Component's behavior from outside, after the render. For example I want to set some scroll view insets after a component is realized, and subclassing component seems like a bit much. What do you think?

Multi-line labels

I can't find any info about creating multi-line text. Is that possible?

Navigation Component

It would be great if we could wrap UINavigationController in an Navigator(Navigation Component). Not sure how what the api would be.

iOS: table view selection doesn't really work

@joshaber We call reloadData() every time we diff a TableView, and that kills our selection. I'll work on this one โ€“ just putting it here as a reminder.

Current thinking is we need to make Element equatable, and not call reloadData() unless our row data has actually changed. Thoughts?

Animate from state to state

Maybe we can implement something like react.animate. updateState with an extra option to add an animation.

Publicly get a layout Node for an element?

Is there any way to do something like this? In my case I need to use a vanilla UITableView and I'd like to compute the heights for all my elements without creating views for them. Can we make assembleLayoutNode() public, since it has no side effects?

Animations

It should support animations somehow.

Render from the topmost dirty component downward

Currently each component re-renders itself when its state changes. This works, but it's less than ideal.

Consider a component A which renders a component B. If both update their state in the same runloop, component B will be rendered twice: once by itself because of its state update, and once when component A re-renders itself.

We should start each re-render from the topmost dirty component.

(I don't think there are any correctness problems here, but it's certainly less performant.)

Support view-less Elements

Currently there's a 1-to-1 correspondence between Elements and views. But that doesn't necessarily have to be the case. A lot of Elements exist in the hierarchy for layout reasons only. They don't actually need to exist as reified views.

My current thinking is that Element shouldn't create a view but be used only for layout.

Input does not seem to follow "stretch" rule

The Input element does not seem to follow the .childAlignment(.Stretch) property. I have attached a screenshot (I'm bad at designing but these colors are used for clarity of the issue ๐Ÿ˜‰) and the example view code. I believe my code is right as the "Welcome!" Label and the bottom border views are stretched. BUT please let me know if it is something with just my code ๐Ÿ˜‡

Screenshot (duh)

ios simulator screen shot jun 23 2015 9 33 48 pm

Code (even more duh)

return View(backgroundColor: UIColor.lightGrayColor())
    .justification(.FlexStart)
    .childAlignment(.Center)
    .direction(.Column)
    .children([

        View(backgroundColor: UIColor.orangeColor())
            .childAlignment(.Stretch)
            .direction(.Column)
            .width(300)
            .margin(Edges(left: 0, right: 0, bottom: 0, top: 80))
            .padding(Edges(left: 20, right: 20, bottom: 20, top: 20))
            .children([

                // Label
                { () -> Label in
                    let l = Label("Welcome!",
                        textColor: UIColor.darkGrayColor(),
                        font: UIFont.boldSystemFontOfSize(26))
                        .margin(Edges(left: 0, right: 0, bottom: 20, top: 0))
                    l.selfAlignment(.Center)
                    return l
                }(),

                // Input - Email
                Input(textColor: UIColor.blackColor(),
                    placeholder: "Email",
                    keyboardType: UIKeyboardType.EmailAddress,
                    returnKeyType: UIReturnKeyType.Next,
                    borderStyle: UITextBorderStyle.RoundedRect)
                    .margin(Edges(left: 0, right: 0, bottom: 0, top: 0)),

                // Border View
                View(backgroundColor: UIColor.darkGrayColor())
                    .height(1)
                    .margin(Edges(left: 0, right: 0, bottom: 20, top: 2)),

                // Input - Password
                Input(textColor: UIColor.blackColor(),
                    placeholder: "Password",
                    returnKeyType: UIReturnKeyType.Done,
                    secure: true),

                // Border View
                View(backgroundColor: UIColor.darkGrayColor())
                    .height(1)
                    .margin(Edges(left: 0, right: 0, bottom: 10, top: 2))

            ])

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.