I have two targets (Target A
, Target B
) and from Target B
I would like to call a function which is located in Target A
. I get the Use of Unresolved Identifier
error when trying to compile as expected since ClassA.swift
isn't part of Target B
. So I tried to set the Target membership of ClassA.swift
to include Target B
as well but the issue with this is that ClassA.swift
touches so many files and also imports different modules. It wouldn't make sense to include everything else in Target B
. I also tried to set the ClassA
as open
by declaring it as such but that doesn't do anything (maybe I'm doing something wrong there). Not really sure what else I can try to call the function in Target A
from Target B
Target A > ClassA.swift > staticFunctionA()
Target B > ClassB.swift (calls staticFunctionA())
ClassA.swift
has a few functions and those functions touch a number of files. This file is a wrapper file for a lot of other things that is does. Of course if I make this file as part of Target B
, I'll have to make other files part of Target B
as well.
To share the code in different targets, select ClassA.swift then check target which you would like to share ClassA.swift at "Target Membership" section