Git Product home page Git Product logo

Comments (6)

davdroman avatar davdroman commented on July 1, 2024

Hi @Rich86man:

Could you please tell me exactly what you changed and how the whole code block turns out to be? I believe there's nothing wrong with the constraint-choosing logic in Popsicle, but let's make sure :)

from popsicle.

Rich86man avatar Rich86man commented on July 1, 2024

let xInterpolation = Interpolation(imageView, centerXConstraint)

to

let xInterpolation = Interpolation(imageView, widthConstraint)

Looking at the storyboard there is a width constraint on the image view being interpolated.

I ran into the same issue in my own project when I tried to interpolate the width of an image view so I decided to try to interpolate a width of an object in the sample project.

I ended up doing something like this to achieve the effect

@IBOutlet weak var imageViewWidthConstraint: NSLayoutConstraint!
let constraintKeyPath = KeyPath<NSLayoutConstraint, CGFloat>(keyPathable: "constant")
let imageViewSize = Interpolation(imageViewWidthConstraint, constraintKeyPath)

But it would be nice to not need the extra outlet. Am I using it wrong?

from popsicle.

davdroman avatar davdroman commented on July 1, 2024

But it would be nice to not need the extra outlet. Am I using it wrong?

Absolutely, that's the idea behind those constraint keypaths. Give me some time to discover what's the problem.

from popsicle.

davdroman avatar davdroman commented on July 1, 2024

Oh shoot! I just realised what the problem is. Popsicle only checks the view's superview constraints, but unlike positioning constraints, width and height constraints are applied to the view itself, so Popsicle finds no width or height constraint attached to the superview.

I'll work out a solution and push it as 2.0.1.

from popsicle.

Rich86man avatar Rich86man commented on July 1, 2024

Awesome. Thanks! Loving Popsicle btw

from popsicle.

davdroman avatar davdroman commented on July 1, 2024

@Rich86man fixed! Enjoy :)

from popsicle.

Related Issues (20)

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.