title: Localization Swizzling change languages swift4 with selector
body: <p>I am trying to change the app language and using the Swizzling function, but the problem when calling DoTheSwizzling() crash in selector! I think can't find "specialLocalizedStringForKey" so it gives me nil, I don't know what's wrong?</p>
  
  <pre><code> class Languages {
  
          class func DoTheSwizzling() {
  
              MethodSwizzleGivenClassName(cls: Bundle.self, originalSelector: #selector(Bundle.localizedString(forKey:value:table:)), overrideSelector: Selector(("specialLocalizedStringForKey:value:table:")))
          }
      }
  
      extension Bundle {
          func specialLocalizedStringForKey(key: String, value: String?, table tableName: String?) -&gt; String {
              let currentLanguage = Languages.currentAppleLanguage()
              var bundle = Bundle();
              if let _path = Bundle.main.path(forResource: currentLanguage, ofType: "lproj") {
                  bundle = Bundle(path: _path)!
              } else {
                  let _path = Bundle.main.path(forResource: "Base", ofType: "lproj")!
                  bundle = Bundle(path: _path)!
              }
              return (bundle.specialLocalizedStringForKey(key: key, value: value, table: tableName))
          }
      }
  
  
      func MethodSwizzleGivenClassName(cls: AnyClass, originalSelector: Selector, overrideSelector: Selector) {
  
          let origMethod: Method = class_getInstanceMethod(cls, originalSelector)!;
          let overrideMethod: Method = class_getInstanceMethod(cls, overrideSelector)!;
  
          if (class_addMethod(cls, originalSelector, method_getImplementation(overrideMethod), method_getTypeEncoding(overrideMethod))) {
              class_replaceMethod(cls, overrideSelector, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
          } else {
              method_exchangeImplementations(origMethod, overrideMethod);
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iLkQC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iLkQC.png" alt="enter image description here"></a></p>