31 lines
		
	
	
		
			737 B
		
	
	
	
		
			Swift
		
	
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			737 B
		
	
	
	
		
			Swift
		
	
	
|  | // Message.swift | ||
|  | // Message class for State Machine communication | ||
|  | // Equivalent to Android's Message class | ||
|  | 
 | ||
|  | import Foundation | ||
|  | 
 | ||
|  | /// Message class for state machine communication | ||
|  | public class Message { | ||
|  |     /// The message identifier | ||
|  |     public let what: Int | ||
|  |      | ||
|  |     /// First argument value | ||
|  |     public let arg1: Int | ||
|  |      | ||
|  |     /// Second argument value | ||
|  |     public let arg2: Int | ||
|  |      | ||
|  |     /// Object associated with this message | ||
|  |     public let obj: Any? | ||
|  |      | ||
|  |     public let callback: (() -> Void)? | ||
|  |      | ||
|  |     init(what: Int, arg1: Int = 0, arg2: Int = 0, obj: Any? = nil, callback: (() -> Void)? = nil) { | ||
|  |         self.what = what | ||
|  |         self.arg1 = arg1 | ||
|  |         self.arg2 = arg2 | ||
|  |         self.obj = obj | ||
|  |         self.callback = callback | ||
|  |     } | ||
|  | } |