이전 Obj-c 앱을 기반으로하는 새로운 Swift 앱을 제작하고 있습니다. 내가했던파일 범위? 신속한 대리인 및 프로토콜
class MyAppViewController: CustomViewController {
var delegate: MyAppViewControllerDelegate?
protocol MyAppViewControllerDelegate{
func myAppViewController(controller: MyAppViewController, loggedInStudent: MYStudent)
func myAppViewControllerWantsSignUp(controller: MyAppViewController)
: 저는 현재
여기내 OBJ-C 코드는 내가 한 SWIFT에서 .H 파일에 같은
@interface MyAppViewController : CustomViewController
@property (nonatomic, weak) id<MyAppViewControllerDelegate> delegate;
@end
@protocol MyAppViewControllerDelegate <NSObject>
- (void)myAppViewController:(MyAppViewController *)controller loggedInStudent: (MYStudent *)student;
- (void)myAppViewControllerWantsSignUp:(MyAppViewController *)controller;
@end
을 속입니다 대표 일하고 있어요 이것에 대한 독서와 연구가 많이 있었기 때문에 나는 기본적으로 올바르게하고 있다고 생각했다. (완전히 새로운 것이었지만 ...)
의 "Declaration is only valid in file scope
" 이 클래스 내에서 선언과 관련이 있다고 가정 했으므로 클래스 내에서 내 코드가 선언 한 대리자 변수를 인식하지 못했습니다.
아이디어가 있으십니까?