New answers tagged

1

I would move more logic to an Enum CardInfo struct CardInfo { enum CardState { case expanded case collapased var nextState : CardState { return isExpanded ? .collapased : .expanded } var isExpanded: Bool { self == .expanded } } enum CardType { case annotaion case chat } ...


0

Unit Tests should not have a dependency on the application bundle at runtime which could not be injected on the init phase or by a method arguments The given Utility class has a static methods which act like a shortcuts to longer syntax calls. This methods calls directly methods on Bundle class object which is cannot be mocked. The solution is to move ...


2

A few big picture observations: You really shouldn’t have this much animation code in your view controller. For example, rather than using view controller containment, I might do a “modal” presentation with a modalPresentationStyle of .overCurrentContext. That gets you out the child view controller containment code. And you can move your animation code ...


2

Is there a way to tidy up the numerous functions into something like a dictionary? Sure, there are various options. But first the functions should be made independent of maxIterations, i.e. the computation Double(currentIteration) / Double(maxIterations) should be done in the caller so that the functions simplify to private func sine010(x: Double) ->...


Top 50 recent answers are included