Skip to content

Commit

Permalink
fix: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
PouriaAmini committed Jul 11, 2024
1 parent f5efd78 commit 6b57830
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class UIKitUserInteractions {
private static let initializeSwizzle: () = {
swizzleSendAction()
}()

private static let initializeNotificationListeners: () = {
NotificationCenter.default.addObserver(UITextField.self, selector: #selector(UITextField.amp_textFieldBeganEditing), name: UITextField.textDidBeginEditingNotification, object: nil)
NotificationCenter.default.addObserver(UITextField.self, selector: #selector(UITextField.amp_textFieldEndedEditing), name: UITextField.textDidEndEditingNotification, object: nil)
Expand Down Expand Up @@ -89,7 +89,7 @@ extension UIView {
let targetText: String?
let hierarchy: String
}

func eventFromData(with action: Selector) -> UserInteractionEvent {
let viewData = extractData(with: action)
return UserInteractionEvent(
Expand Down Expand Up @@ -162,15 +162,15 @@ extension UITextField: Trackable {
func shouldTrack(_ action: Selector, for event: UIEvent?) -> Bool {
false
}

@objc static func amp_textFieldBeganEditing(_ notification: NSNotification) {
guard let textField = notification.object as? UITextField else { return }
let userInteractionEvent = textField.eventFromData(with: #selector(UITextField.amp_textFieldBeganEditing))
UIKitUserInteractions.amplitudeInstances.allObjects.forEach {
$0.track(event: userInteractionEvent)
}
}

@objc static func amp_textFieldEndedEditing(_ notification: NSNotification) {
guard let textField = notification.object as? UITextField else { return }
let userInteractionEvent = textField.eventFromData(with: #selector(UITextField.amp_textFieldEndedEditing))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UIKitUserInteractionsTests: XCTestCase {
XCTAssertNil(orphanData.targetText)
XCTAssertEqual(orphanData.hierarchy, "UIView")
}

func testDescriptiveTypeName() {
let button = UIButton()
XCTAssertEqual(button.descriptiveTypeName, "UIButton")
Expand Down

0 comments on commit 6b57830

Please sign in to comment.