func eventPropertiesSet()

in SasquatchMac/SasquatchMac/ViewControllers/AnalyticsViewController.swift [228:259]


  func eventPropertiesSet() -> Any? {
    if eventProperties.count < 1 {
      return nil
    }
    var onlyStrings = true
    var propertyDictionary = [String: String]()
    let properties = EventProperties()
    for property in eventProperties {
      let key = property.key
      guard let type = EventPropertyType(rawValue: property.type) else {
        continue
      }
      switch type {
      case .string:
        properties.setEventProperty(property.string, forKey: key);
        propertyDictionary[property.key] = property.string
      case .double:
        properties.setEventProperty(property.double.doubleValue, forKey: key)
        onlyStrings = false
      case .long:
        properties.setEventProperty(property.long.int64Value, forKey: key)
        onlyStrings = false
      case .boolean:
        properties.setEventProperty(property.boolean, forKey: key)
        onlyStrings = false
      case .dateTime:
        properties.setEventProperty(property.dateTime, forKey: key)
        onlyStrings = false
      }
    }
    return onlyStrings ? propertyDictionary : properties
  }