Skip to content
Snippets Groups Projects

VLCKit: Change the notification name from NSString to NSNotificationName and unify the naming convention

Merged Hank Anderson requested to merge Sumou/VLCKit:notification-name-refactor into master

Change the notification name from NSString to NSNotificationName and unify the naming convention.

before

// Obj-C
NSString *name = VLCMediaPlayerTimeChanged;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(method) name: name object: nil];
// Swift
let name: Notification.Name = .init(rawValue: VLCMediaPlayerTimeChanged)
NotificationCenter.default.addObserver(self, selector: #selector(method), name: name, object: nil)

after

// Obj-C
NSNotificationName name = VLCMediaPlayerTimeChangedNotification;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(method) name: name object: nil];
// Swift
let name: NSNotification.Name = VLCMediaPlayer.timeChangedNotification
NotificationCenter.default.addObserver(self, selector: #selector(method), name: name, object: nil)

Referenced implementation of Apple Framework

// Obj-C
NSNotificationName name = UIApplicationDidBecomeActiveNotification;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(method) name: name object: nil];
// Swift
let name: NSNotification.Name = UIApplication.didBecomeActiveNotification
NotificationCenter.default.addObserver(self, selector: #selector(method), name: name, object: nil)

best regards.

Edited by Felix Paul Kühne

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading