#if os(tvOS) doesn't works in package.swift

I created package.swift for my framework. And was work correctly in iOS. Now we need to support tvOS. I don't understood how can we do it. Because source code is different but networking layer is same. When I create dynamic targets: extension Target{ static func allTargets() -> [Target]{ return ([ Target.SDKTarget(), ] as [[Target]]).flatMap{$0} }

static func SDKTarget() -> [Target] { #if os(tvOS) return [ .target(name: frameworkName, dependencies: [ .product(name: "GRPC", package: "grpc-swift"), ], path: "Sources/tvOS",

         )
]

#else

and when I select tvOS build this code in preprocessor block still gray and won't compile.

How to make single package.swift for my framework for support tvOS and iOS with different code base and shared networking source code?

#if os(tvOS) doesn't works in package.swift
 
 
Q