小知识八、以一种的优雅的方式管理

eg:

extension Selector {
    static let toMenu = #selector(ShoppingCartVC.viewClick(button:))
    static let toExtra = #selector(ShoppingCartVC.leftViewClick(button:))
}

let rightItem = UIBarButtonItem(customView: button)
rightItem.target = self
rightItem.action = Selector.toMenu
self.navigationItem.setRightBarButton(rightItem, animated: true)

你可能感兴趣的:(小知识八、以一种的优雅的方式管理)