Giter VIP home page Giter VIP logo

Comments (3)

tbaranes avatar tbaranes commented on May 22, 2024

The current ideas suggested (which could be working) in order to make that thread going further:

  1. Wave(up,40,10): MaskType(param1,param2,param3)
  2. More AnimatableView's children to add custom designable properties following the shape
  3. Other suggestions?

I prefer the first solution, but it could be maybe too hard to use, or improving a bit the syntax to be a bit more swift: Wave(direction:up,width:40,offset:10) (still annoying since the syntax is really strict)

from ibanimatable.

tbaranes avatar tbaranes commented on May 22, 2024

Another approach:

public enum Mask {
    case Circle()
    case Star(branches: Int)
    case Wave(up: Bool, width: Int, offset: Int)
}

Mask.Circle()
Mask.Star(branches: 5)
Mask.Wave(up: true, width: 40, offset: 40)

I still missing a nice way to make this working with the interface builder, but I find this approach more swifty.

from ibanimatable.

JakeLin avatar JakeLin commented on May 22, 2024

@tbaranes @lexrus came up similar ideas before to use Swiftified enum. But since IB doesn't support enum yet, it can't fix our problem.

I prefer option one, and it can at least move us forward. If we can support option one, we can subclass AnimatableView to support option two if needed.

To get the benefit of Swiftified enum, we can have

public enum Mask {
    case Circle()
    case Star(branches: Int)
    case Wave(up: Bool, width: Int, offset: Int)
}

in code then map the String value e.g. Star(6) to Star(branches:6) for IB. And fall back to default value Star(branches:5) if the user put it wrongly like Star5, Star(12 or Star2)

from ibanimatable.

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.