Giter VIP home page Giter VIP logo

Comments (5)

lexrus avatar lexrus commented on May 16, 2024

It's a dirty workaround which should be avoid in the master branch.
The App may crash at runtime if there's another user-defined UIView subclass which has the same IBInspectable animationType property but does not has the animationTypeRaw.

from ibanimatable.

lexrus avatar lexrus commented on May 16, 2024

Is it possible to specify the default NSKeyedUnarchiver for a Storyboard?

from ibanimatable.

lexrus avatar lexrus commented on May 16, 2024

Another concept is, since UIView is inherited from NSObject, we can add properties with class_addProperty function via runtime. Then the animationTypeRaw is not required.

from ibanimatable.

JakeLin avatar JakeLin commented on May 16, 2024

@lexrus Method Swizzling is hacky, it pollute all namespace. I tried to use Swift protocol extension to avoid some caveats. for example, create an extension property for animationTypeRaw

public var animationTypeRaw: String? {
      get {
        return self.animationType.debugDescription
      }
      set {
        self.animationType = AnimationType(rawValue: newValue ?? "")
      }
}

to provide default implementation for associating animationType and animationTypeRaw but Objective C cannot access this Swift extension.

Also, there is no sealed method to prevent the subclass override the default implementation of animationTypeRaw. If some one subclass Animatable and then have to understand how animationType and animationTypeRaw work together.

I am still finding the way to balance that and put it on hold at that moment to work on other features.

from ibanimatable.

lexrus avatar lexrus commented on May 16, 2024

Agree.
Shall we set a roadmap for what to do next? Or tag priority of each issue?

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.