88
99import Darwin
1010
11- // TODO: change .append() to +=
12-
1311// NOTE: nested type inside generic StateMachine class is not allowed in Swift 1.1
1412// NOTE: 'public struct' didn't work since Xcode6-beta6
1513public class StateMachineRouteID < S: StateType , E: StateEventType >
@@ -164,7 +162,7 @@ public class StateMachine<S: StateType, E: StateEventType>
164162 else {
165163 for (ev, transitionDict) in self . _routes {
166164 if ev == event || ev == nil as Event {
167- transitionDicts. append ( transitionDict)
165+ transitionDicts += [ transitionDict]
168166 break
169167 }
170168 }
@@ -273,21 +271,21 @@ public class StateMachine<S: StateType, E: StateEventType>
273271 var transitions : [ Transition ] = [ ]
274272
275273 // anywhere
276- transitions. append ( nil => nil )
274+ transitions += [ nil => nil ]
277275
278276 // exit
279277 if transition. fromState != nil as State {
280- transitions. append ( transition. fromState => nil )
278+ transitions += [ transition. fromState => nil ]
281279 }
282280
283281 // entry
284282 if transition. toState != nil as State {
285- transitions. append ( nil => transition. toState)
283+ transitions += [ nil => transition. toState]
286284 }
287285
288286 // specific
289287 if ( transition. fromState != nil as State ) && ( transition. toState != nil as State ) {
290- transitions. append ( transition)
288+ transitions += [ transition]
291289 }
292290
293291 return transitions
@@ -661,7 +659,7 @@ public class StateMachine<S: StateType, E: StateEventType>
661659
662660 for route in chain. routes {
663661 let routeID = self . addRoute ( route)
664- routeIDs. append ( routeID)
662+ routeIDs += [ routeID]
665663 }
666664
667665 let handlerID = self . addChainHandler ( chain, handler: handler)
@@ -741,7 +739,7 @@ public class StateMachine<S: StateType, E: StateEventType>
741739 }
742740 }
743741 }
744- handlerIDs. append ( handlerID)
742+ handlerIDs += [ handlerID]
745743
746744 // increment chainingCount on every route
747745 for route in chain. routes {
@@ -763,7 +761,7 @@ public class StateMachine<S: StateType, E: StateEventType>
763761 }
764762 }
765763 }
766- handlerIDs. append ( handlerID)
764+ handlerIDs += [ handlerID]
767765 }
768766
769767 // increment allCount (+ invoke chainErrorHandler) on any routes
@@ -783,7 +781,7 @@ public class StateMachine<S: StateType, E: StateEventType>
783781 }
784782 }
785783 }
786- handlerIDs. append ( handlerID)
784+ handlerIDs += [ handlerID]
787785
788786 // invoke chainHandler on last route
789787 let lastRoute = chain. routes. last!
@@ -802,7 +800,7 @@ public class StateMachine<S: StateType, E: StateEventType>
802800 }
803801 }
804802 }
805- handlerIDs. append ( handlerID)
803+ handlerIDs += [ handlerID]
806804
807805 let bundledHandlerID = HandlerID ( bundledHandlerIDs: handlerIDs)
808806
@@ -818,7 +816,7 @@ public class StateMachine<S: StateType, E: StateEventType>
818816 var routes : [ Route ] = [ ]
819817 for transition in transitions {
820818 let route = Route ( transition: transition, condition: condition)
821- routes. append ( route)
819+ routes += [ route]
822820 }
823821
824822 return self . addRouteEvent ( event, routes: routes)
@@ -834,7 +832,7 @@ public class StateMachine<S: StateType, E: StateEventType>
834832 var routeIDs : [ RouteID ] = [ ]
835833 for route in routes {
836834 let routeID = self . _addRoute ( route, forEvent: event)
837- routeIDs. append ( routeID)
835+ routeIDs += [ routeID]
838836 }
839837
840838 return routeIDs
0 commit comments