func eventProperties()

in Sasquatch/Sasquatch/ViewControllers/Sections/EventPropertiesTableSection.swift [42:69]


  func eventProperties() -> Any? {
    if typedProperties.count < 1 {
      return nil
    }
    var onlyStrings = true
    var propertyDictionary = [String: String]()
    let eventProperties = EventProperties()
    for property in typedProperties {
      switch property.type {
      case .String:
        eventProperties.setEventProperty(property.value as! String, forKey: property.key);
        propertyDictionary[property.key] = (property.value as! String)
      case .Double:
        eventProperties.setEventProperty(property.value as! Double, forKey: property.key)
        onlyStrings = false
      case .Long:
        eventProperties.setEventProperty(property.value as! Int64, forKey: property.key)
        onlyStrings = false
      case .Boolean:
        eventProperties.setEventProperty(property.value as! Bool, forKey: property.key)
        onlyStrings = false
      case .DateTime:
        eventProperties.setEventProperty(property.value as! Date, forKey: property.key)
        onlyStrings = false
      }
    }
    return onlyStrings ? propertyDictionary : eventProperties
  }