Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile errors for visionOS #5089

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 53;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -1055,10 +1055,12 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
TVOS_DEPLOYMENT_TARGET = 12.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1248,10 +1250,12 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
TVOS_DEPLOYMENT_TARGET = 12.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down
48 changes: 37 additions & 11 deletions ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 55;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -12,7 +12,7 @@
068A9B191FBBF351003CF1AD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B8EAF2F1AB32E15009697AA /* Images.xcassets */; };
068A9B1A1FBBF355003CF1AD /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B64D06EA1FB199130067418D /* Launch Screen.storyboard */; };
068A9B1B1FBBF366003CF1AD /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 5B613DA31D526AD5000F1E98 /* [email protected] */; };
06FF5D7529BD10650002256E /* DGCharts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 06FF5D7229BD10650002256E /* DGCharts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
06FF5D7529BD10650002256E /* DGCharts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 06FF5D7229BD10650002256E /* DGCharts.framework */; platformFilters = (ios, tvos, ); settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
225B36201F6EB9A50005B3D5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B361F1F6EB9A50005B3D5 /* AppDelegate.swift */; };
225B36311F6EB9EE0005B3D5 /* DemoBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B362F1F6EB9EE0005B3D5 /* DemoBaseViewController.swift */; };
225B36321F6EB9EE0005B3D5 /* DemoListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36301F6EB9EE0005B3D5 /* DemoListViewController.swift */; };
Expand Down Expand Up @@ -864,11 +864,16 @@
0630AE541D81271B008859B0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Charts;
platformFilters = (
ios,
tvos,
);
targetProxy = 0630AE531D81271B008859B0 /* PBXContainerItemProxy */;
};
225B368F1F6EBBB00005B3D5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Charts;
platformFilter = ios;
targetProxy = 225B368E1F6EBBB00005B3D5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
Expand All @@ -895,13 +900,18 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,7";
};
name = Debug;
};
Expand All @@ -927,11 +937,16 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,7";
};
name = Release;
};
Expand Down Expand Up @@ -1033,7 +1048,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
Expand All @@ -1050,15 +1066,20 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "ChartsDemo-iOS";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,7";
};
name = Debug;
};
Expand All @@ -1073,14 +1094,19 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "ChartsDemo-iOS";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,7";
};
name = Release;
};
Expand Down
6 changes: 5 additions & 1 deletion Source/Charts/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,12 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
/// - Returns: The bitmap that represents the chart.
@objc open func getChartImage(transparent: Bool) -> NSUIImage?
{

#if os(visionOS)
NSUIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque || !transparent, 1.0)
#else
NSUIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque || !transparent, NSUIMainScreen()?.nsuiScale ?? 1.0)
#endif
guard let context = NSUIGraphicsGetCurrentContext()
else { return nil }

Expand Down
2 changes: 2 additions & 0 deletions Source/Charts/Utils/Platform+Accessibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ open class NSUIAccessibilityElement: UIAccessibilityElement
set
{
guard let containerView = containerView else { return }
#if !os(visionOS)
super.accessibilityFrame = containerView.convert(newValue, to: UIScreen.main.coordinateSpace)
#endif
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions Source/Charts/Utils/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
public typealias NSUIFont = UIFont
public typealias NSUIImage = UIImage
public typealias NSUIScrollView = UIScrollView
#if !os(visionOS)
public typealias NSUIScreen = UIScreen
#endif
public typealias NSUIDisplayLink = CADisplayLink

extension NSUIColor
Expand Down Expand Up @@ -48,7 +50,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
set { isScrollEnabled = newValue }
}
}
#if !os(visionOS)
extension UIScreen
{
@objc final var nsuiScale: CGFloat
Expand All @@ -61,7 +63,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
{
return NSUIScreen.main
}

#endif
#endif

#if os(OSX)
Expand Down
Loading