class __attribute__()

in ComponentKit/Components/CKTransitionComponent.h [32:122]


class __attribute__((__may_alias__)) TransitionComponentBuilder
: public BuilderBase<TransitionComponentBuilder, PropsBitmap> {
public:
  TransitionComponentBuilder() = default;
  TransitionComponentBuilder(const CK::ComponentSpecContext &context) : BuilderBase<TransitionComponentBuilder, PropsBitmap>{context} { }

  ~TransitionComponentBuilder() = default;

  /**
   A child component that will transition between states in an animated fashion.
   */
  auto &component(NS_RELEASES_ARGUMENT CKComponent *c)
  {
    constexpr auto componentIsNotSet = !PropBitmap::isSet(PropsBitmap, TransitionComponentPropId::component);
    static_assert(componentIsNotSet, "Property 'component' is already set.");
    _component = c;
    return reinterpret_cast<
    TransitionComponentBuilder<PropsBitmap | TransitionComponentPropId::component> &>(*this);
  }

  /**
   An animation to apply to the new generation of the child component.
   */
  auto &transitioningIn(Animation::Initial i)
  {
    _initial = std::move(i);
    return reinterpret_cast<
    TransitionComponentBuilder<PropsBitmap | TransitionComponentPropId::hasTransition> &>(*this);
  }

  /**
  An animation to apply to the previous generation of the child component.
  */
  auto &transitioningOut(Animation::Final f)
  {
    _final = std::move(f);
    return reinterpret_cast<
    TransitionComponentBuilder<PropsBitmap | TransitionComponentPropId::hasTransition> &>(*this);
  }

  /**
   A value changes in which are used to trigger the transition.

   @note  @c RCObjectIsEqual is used to compare the previous and the new value.
   */
  auto &triggerValue(NS_RELEASES_ARGUMENT id<NSObject> triggerValue)
  {
    _triggerValue = triggerValue;
    return reinterpret_cast<
    TransitionComponentBuilder<PropsBitmap | TransitionComponentPropId::hasTrigger> &>(*this);
  }

  /**
   A value changes in which are used to trigger the transition.

   @note  @c T::operator == is used to compare the previous and the new value.
   */
  template <typename T>
  auto &triggerValue(T triggerValue)
  {
    _triggerValue = CKIdValueWrapperCreate<T>(triggerValue);
    return reinterpret_cast<
    TransitionComponentBuilder<PropsBitmap | TransitionComponentPropId::hasTrigger> &>(*this);
  }

private:
  friend BuilderBase<TransitionComponentBuilder, PropsBitmap>;

  /**
   Creates a new component instance with specified properties.

   @note  This method must @b not be called more than once on a given component builder instance.
   */
  NS_RETURNS_RETAINED auto _build() noexcept -> CKComponent *
  {
    constexpr auto componentIsSet = PropBitmap::isSet(PropsBitmap, TransitionComponentPropId::component);
    static_assert(componentIsSet, "Required property 'component' is not set.");
    constexpr auto hasTransition = PropBitmap::isSet(PropsBitmap, TransitionComponentPropId::hasTransition);
    static_assert(hasTransition, "At least one transition must be specified using 'transitioningIn' or 'transitioningOut'.");
    constexpr auto hasTrigger = PropBitmap::isSet(PropsBitmap, TransitionComponentPropId::hasTrigger);
    static_assert(hasTrigger, "At least one trigger must be specified using 'triggerValue'.");

    return TransitionComponentDetails::factory(_component, _initial, _final, _triggerValue);
  }

private:
  CKComponent *_component;
  Optional<Animation::Initial> _initial{};
  Optional<Animation::Final> _final{};
  id<NSObject> _triggerValue;
};