From b2980c62581ed44e8c948264eed44aa3733ae518 Mon Sep 17 00:00:00 2001 From: Willian Date: Thu, 30 Jun 2022 16:05:34 +0300 Subject: [PATCH] add swift wrapper for objc code --- RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h | 4 ++-- RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m | 3 ++- .../RoadToSPMModuleNotFound/ViewController.swift | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h index b2a13a9..d324299 100644 --- a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h +++ b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.h @@ -7,10 +7,10 @@ #import -@class SwiftClassB; +@class ObjcClassContainer; @interface ObjcClass : NSObject -@property SwiftClassB *swiftclass; +@property ObjcClassContainer *swiftContainer; @end diff --git a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m index 7b78444..7fb299d 100644 --- a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m +++ b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/Test.m @@ -8,11 +8,12 @@ #import #import "Test.h" #import +#import "RoadToSPMModuleNotFound-Swift.h" @implementation ObjcClass -(void) doStuff { - self.swiftclass.prop = 4; + self.swiftContainer.swiftclass.prop = 4; } @end diff --git a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/ViewController.swift b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/ViewController.swift index 9e89095..7bf98ec 100644 --- a/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/ViewController.swift +++ b/RoadToSPMModuleNotFound/RoadToSPMModuleNotFound/ViewController.swift @@ -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() }