feat(mac): support for Mac Catalyst with ui-mobile-base

This commit is contained in:
Nathan Walker
2022-06-16 13:49:27 -07:00
parent 957af32859
commit fc77c92e11
22 changed files with 326 additions and 14 deletions

View File

@ -4,6 +4,37 @@
<dict> <dict>
<key>AvailableLibraries</key> <key>AvailableLibraries</key>
<array> <array>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict> <dict>
<key>DebugSymbolsPath</key> <key>DebugSymbolsPath</key>
<string>dSYMs</string> <string>dSYMs</string>
@ -21,20 +52,6 @@
<key>SupportedPlatformVariant</key> <key>SupportedPlatformVariant</key>
<string>simulator</string> <string>simulator</string>
</dict> </dict>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array> </array>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>XFWK</string> <string>XFWK</string>

View File

@ -0,0 +1,24 @@
//
// NSData+Async.h
// TNSWidgets
//
// Created by Peter Staev on 7.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSData (Async)
+ (void)dataWithContentsOfFile:(nonnull NSString*)path
completion:(void (^) (NSData*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) (void))callback;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,25 @@
//
// NSString+Async.h
// TNSWidgets
//
// Created by Peter Staev on 5.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (Async)
+ (void)stringWithContentsOfFile:(nonnull NSString*)path
encoding:(NSStringEncoding)enc
completion:(void (^) (NSString*, NSError*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
encoding:(NSStringEncoding)enc
completion:(void (^) (NSError*))callback;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,16 @@
//
// TNSLabel.h
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TNSLabel : UILabel
@property(nonatomic) UIEdgeInsets padding;
@property(nonatomic) UIEdgeInsets borderThickness;
@end

View File

@ -0,0 +1,29 @@
//
// TNSProcess.h
// TNSWidgets
//
// Created by Panayot Cankov on 15/05/2017.
// Copyright © 2017 Telerik A D. All rights reserved.
//
#ifndef TNSProcess_h
#define TNSProcess_h
#import <Foundation/Foundation.h>
/**
* Get the milliseconds since the process started.
*/
double __tns_uptime(void);
/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.
* We rarely need to log in release but in cases such as when logging app startup times in release,
* this will be convenient shortcut to NSLog, NSLog is not exposed.
*
* Please note the {N} CLI may be filtering app output, prefixing the message with "CONSOLE LOG"
* will make the logs visible in "tns run ios --release" builds.
*/
void __nslog(NSString* message);
#endif /* TNSProcess_h */

View File

@ -0,0 +1,24 @@
//
// TNSWidgets.h
// TNSWidgets
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TNSWidgets.
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;
//! Project version string for TNSWidgets.
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
#import "UIImage+TNSBlocks.h"
#import "UIView+PassThroughParent.h"
#import "TNSLabel.h"
#import "TNSProcess.h"
#import "NSString+Async.h"
#import "NSData+Async.h"

View File

@ -0,0 +1,26 @@
//
// UIImage+UIImage_Async.h
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
@interface UIImage (TNSBlocks)
/**
* Similar to imageNamed: however it runs on a separate queue so the UI thread is not blocked.
* It also draws the UIImage in a small thumb to force decoding potentially avoiding UI hicckups when displayed.
*/
+ (void) tns_safeDecodeImageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;
/**
* Same as imageNamed, however calls to this method are sinchronized to be thread safe in iOS8 along with calls to tns_safeImageNamed and tns_safeDecodeImageNamed:completion:
* imageNamed is thread safe in iOS 9 and later so in later versions this methods simply fallbacks to imageNamed:
*/
+ (UIImage*) tns_safeImageNamed: (NSString*) name;
+ (void) tns_decodeImageWithData: (NSData*) data completion: (void (^) (UIImage*))callback;
+ (void) tns_decodeImageWidthContentsOfFile: (NSString*) file completion: (void (^) (UIImage*))callback;
@end

View File

@ -0,0 +1,17 @@
//
// UIView+PassThroughParent.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (PassThroughParent)
- (BOOL) passThroughParent;
- (void) setPassThroughParent:(BOOL) passThroughParent;
@end

View File

@ -0,0 +1,6 @@
framework module TNSWidgets {
umbrella header "TNSWidgets.h"
export *
module * { export * }
}

View File

@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (Swizzling)
+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;
@end

View File

@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (PropertyBag)
- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;
@end

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>21E258</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>TNSWidgets</string>
<key>CFBundleIdentifier</key>
<string>org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>TNSWidgets</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13F17a</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>12.3</string>
<key>DTSDKBuild</key>
<string>21E226</string>
<key>DTSDKName</key>
<string>macosx12.3</string>
<key>DTXcode</key>
<string>1340</string>
<key>DTXcodeBuild</key>
<string>13F17a</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
</dict>
</plist>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -31,6 +31,19 @@ xcodebuild \
SKIP_INSTALL=NO \ SKIP_INSTALL=NO \
-quiet -quiet
echo "Build for Mac Catalyst"
xcodebuild \
-project TNSWidgets/TNSWidgets.xcodeproj \
-scheme TNSWidgets \
-configuration Release \
-destination "generic/platform=macOS,variant=Mac Catalyst" \
clean build \
BUILD_DIR=$(PWD)/TNSWidgets/build \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
SKIP_INSTALL=NO \
-quiet
echo "Creating XCFramework" echo "Creating XCFramework"
xcodebuild \ xcodebuild \
-create-xcframework \ -create-xcframework \
@ -38,4 +51,6 @@ xcodebuild \
-debug-symbols $(PWD)/TNSWidgets/build/Release-iphoneos/TNSWidgets.framework.dSYM \ -debug-symbols $(PWD)/TNSWidgets/build/Release-iphoneos/TNSWidgets.framework.dSYM \
-framework $(PWD)/TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework \ -framework $(PWD)/TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework \
-debug-symbols $(PWD)/TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework.dSYM \ -debug-symbols $(PWD)/TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework.dSYM \
-framework $(PWD)/TNSWidgets/build/Release-maccatalyst/TNSWidgets.framework \
-debug-symbols $(PWD)/TNSWidgets/build/Release-maccatalyst/TNSWidgets.framework.dSYM \
-output $(PWD)/TNSWidgets/build/TNSWidgets.xcframework -output $(PWD)/TNSWidgets/build/TNSWidgets.xcframework