Example #1
0
        // returns:  The 'type' of HomeKit condition, with associated value, if applicable.
        public static HomeKitCondition HomeKitConditionType(this NSPredicate self)
        {
            var characteristicPair = self.GetCharacteristicPair();

            if (characteristicPair != null)
            {
                return(HomeKitCondition.CreateCharacteristic(characteristicPair.Item1, characteristicPair.Item2));
            }

            var sunStatePair = self.GetSunStatePair();

            if (sunStatePair != null)
            {
                return(HomeKitCondition.CreateSunTime(sunStatePair.Item1, sunStatePair.Item2));
            }

            var exactTimePair = self.GetExactTimePair();

            return(exactTimePair != null?
                   HomeKitCondition.CreateExactTime(exactTimePair.Item1, exactTimePair.Item2) : HomeKitCondition.Unknown);
        }