Skip to content

Instantly share code, notes, and snippets.

@DaidoujiChen
Created November 5, 2018 16:30
Show Gist options
  • Save DaidoujiChen/7ba689f4f57c52e9fffc90572739a0ca to your computer and use it in GitHub Desktop.
Save DaidoujiChen/7ba689f4f57c52e9fffc90572739a0ca to your computer and use it in GitHub Desktop.
=.= Why shouldAutorotate not work in swift
#import <UIKit/UIKit.h>
@interface UIViewController (OwO)
- (BOOL)shouldAutorotate;
@end
@implementation UIViewController (OwO)
- (BOOL)shouldAutorotate {
NSLog(@"Work");
return false;
}
@end
@interface ViewController : UIViewController
@end
#import "ViewController.h"
@implementation ViewController
@end
import UIKit
extension UIViewController {
var shouldAutorotate: Bool {
print("Not Work")
return false
}
}
class ViewController: UIViewController {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment