Git Product home page Git Product logo

gooey's People

Contributors

k3zi avatar mattmorris92 avatar mr-spod avatar powerje avatar rwachowski avatar thasianx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

k3zi thasianx

gooey's Issues

Deprecate BoundingAnchor.makeEdges(equalTo: UIViewController) and add support for UILayoutGuide instead

Right now, BoundingAnchor provides convenience methods for constraining a view "to a view controller." Internally, this is using the target controller's layout guides and/or view based on iOS version. This definition should be deprecated and replaced with a more-generic one which accepts any UILayoutGuide. To support the deprecated behavior in full, a convenience property of UIViewController which returns a UILayoutGuide corresponding to the version-agnostic safe area of the view could be used instead.

Allow setting priority to ConstraintGroups

It is fairly typical to need to reduce priority for constraints within reusable views to prevent console logs about breaking constraints to acquiesce to UIView-Encapsulated-Layout-Width.

It would be nice if ConstraintGroups supported doing this simply:

NSLayoutConstraint.goo.activate([
    someView.goo.boundingAnchor.makeHorizontalEdges(equalTo: self, insets: .both(.system)).with(priority: .defaultHigh)
])

ConstraintGroup insetting/outsetting/etc... is using the wrong values.

In this function it is insetting the passed in parameter by its self instead of insetting the property insets that exists on the instance.

public func inset(by insets: EdgeInsets<A>) {
let adjusted = insets.uiInsets.goo.inset(by: insets.uiInsets)

Additionally the inset is occurring in the wrong direction for bottom and right constraints:

else if $0.targetsBottom { $0.constant = adjusted.bottom }
else if $0.targetsTrailing { $0.constant = adjusted.right }

From Apple's documentation:

Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

To honor that we must negate the bottom and right for the values of the constants.

Modify ColorToken to "remember" how it was initialized

Right now, the internals of ColorToken only store the [0...255] RGB components. This is fine for a naive implementation and most use cases. For any more robust usages involving other representations, though, the current backing mechanism causes a loss of information. Take, for example, the changes staged in #45. The color white (rgb(255, 255, 255)) is infinite:

ColorToken(hue: .random(in: 0...1), saturation: 0, value: 1)

but for those more robust usages, the following is not necessarily true:

// Does not always hold.
ColorToken(hue: .random(in: 0...1), saturation: 0, value: 1) == ColorToken(hue: .random(in: 0...1), saturation: 0, value: 1)

The proposed solution is to introduce a private nested type for retaining the raw values used to initialize the ColorToken instead of always calculating the RGB components. The existing property accessors/mutators would need modified to either calculate or just return depending on what the storage has retained.

A (perhaps) less-than-desirable consequence of pursuing this change is that equality of two colors becomes a little more complicated. Merely conforming to Equatable is not an option, but it is easy enough to introduce color comparers which know how to reconcile the various properties.

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.