-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ReceivingState block for iOS
Change-Id: I199628efabea227df8555f72c9891cdd21617541
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// -*- mode: swift; swift-mode:basic-offset: 2; -*- | ||
// Copyright 2025 MIT, All rights reserved | ||
// Released under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
import Foundation | ||
|
||
@objc public class ReceivingState: NSObject, OptionList { | ||
@objc public static let Off = ReceivingState(1) | ||
@objc public static let Foreground = ReceivingState(2) | ||
@objc public static let Always = ReceivingState(3) | ||
|
||
private static let LOOKUP: [Int32:ReceivingState] = generateOptionsLookup( | ||
Off, Foreground, Always | ||
) | ||
|
||
let value: Int32 | ||
|
||
@objc private init(_ value: Int32) { | ||
self.value = value | ||
} | ||
|
||
@objc class func fromUnderlyingValue(_ value: Int32) -> ReceivingState? { | ||
return LOOKUP[value] | ||
} | ||
|
||
@objc public func toUnderlyingValue() -> AnyObject { | ||
return value as AnyObject | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters