Skip to content

Commit

Permalink
add swift wrapper for objc code
Browse files Browse the repository at this point in the history
  • Loading branch information
Willianlike committed Jun 30, 2022
1 parent b4cbb38 commit b2980c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

#import <Foundation/Foundation.h>

@class SwiftClassB;
@class ObjcClassContainer;

@interface ObjcClass : NSObject

@property SwiftClassB *swiftclass;
@property ObjcClassContainer *swiftContainer;

@end
3 changes: 2 additions & 1 deletion RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
#import <Foundation/Foundation.h>
#import "Test.h"
#import <ModuleB/ModuleB-Swift.h>
#import "RoadToSPMModuleNotFound-Swift.h"

@implementation ObjcClass

-(void) doStuff {
self.swiftclass.prop = 4;
self.swiftContainer.swiftclass.prop = 4;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ class ViewController: UIViewController {
test.prop = 4

let objc = ObjcClass()
objc.swiftclass.prop = 4
objc.swiftContainer.swiftclass.prop = 4
}

}

@objc class ObjcClassContainer: NSObject {
@objc var swiftclass: SwiftClassB = .init()
}

0 comments on commit b2980c6

Please sign in to comment.