Cкругления glass iOS 26, фикс compiler crash

This commit is contained in:
2026-03-25 17:14:22 +05:00
parent d0041f0c10
commit 872cdb88b0
5 changed files with 22 additions and 35 deletions

View File

@@ -421,7 +421,7 @@
CODE_SIGN_ENTITLEMENTS = Rosetta/Rosetta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = QN8Z263QGX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
@@ -437,7 +437,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.5;
MARKETING_VERSION = 1.2.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -460,7 +460,7 @@
CODE_SIGN_ENTITLEMENTS = Rosetta/Rosetta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = QN8Z263QGX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
@@ -476,7 +476,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.5;
MARKETING_VERSION = 1.2.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -530,7 +530,7 @@
853F296C2F4B50420092AD05 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
853F296D2F4B50420092AD05 /* Build configuration list for PBXNativeTarget "Rosetta" */ = {
isa = XCConfigurationList;
@@ -539,7 +539,7 @@
853F296F2F4B50420092AD05 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
B5D2E60ADEB8AE2E8F7615C6 /* Build configuration list for PBXNativeTarget "RosettaNotificationService" */ = {
isa = XCConfigurationList;
@@ -548,7 +548,7 @@
0140D6320A9CF4B5E933E0B1 /* Debug */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

View File

@@ -31,7 +31,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

View File

@@ -103,6 +103,13 @@ final class _KeyboardSyncedVC<Content: View, Composer: View>: UIViewController,
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError() }
deinit {
// Explicit deinit workaround for Swift compiler crash in Release
// optimization (SILFunctionTransform "EarlyPerfInliner" on deinit).
onComposerHeightChange = nil
onTopSafeAreaChange = nil
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .clear

View File

@@ -108,7 +108,6 @@ final class TelegramGlassUIView: UIView {
// iOS 26+ native glass
private var nativeGlassView: UIVisualEffectView?
private var glassMaskLayer: CAShapeLayer?
override init(frame: CGRect) {
super.init(frame: frame)
@@ -139,6 +138,8 @@ final class TelegramGlassUIView: UIView {
let glassView = UIVisualEffectView(effect: effect)
glassView.clipsToBounds = true
glassView.layer.cornerCurve = .continuous
// Set initial corner radius will be updated in layoutSubviews.
glassView.layer.cornerRadius = 22
glassView.isUserInteractionEnabled = false
addSubview(glassView)
nativeGlassView = glassView
@@ -200,18 +201,7 @@ final class TelegramGlassUIView: UIView {
radius = bounds.height / 2
}
if #available(iOS 26.0, *), let glassView = nativeGlassView {
let mask: CAShapeLayer
if let existing = glassMaskLayer {
mask = existing
} else {
mask = CAShapeLayer()
glassMaskLayer = mask
glassView.layer.mask = mask
}
mask.path = UIBezierPath(
roundedRect: bounds,
cornerRadius: radius
).cgPath
glassView.layer.cornerRadius = radius
} else {
clippingContainer.cornerRadius = radius
layer.cornerRadius = radius
@@ -235,20 +225,9 @@ final class TelegramGlassUIView: UIView {
if #available(iOS 26.0, *), let glassView = nativeGlassView {
glassView.frame = bounds
// UIGlassEffect ignores layer.cornerRadius changes after initial layout.
// Use CAShapeLayer mask guaranteed to clip the glass to any shape.
let mask: CAShapeLayer
if let existing = glassMaskLayer {
mask = existing
} else {
mask = CAShapeLayer()
glassMaskLayer = mask
glassView.layer.mask = mask
}
mask.path = UIBezierPath(
roundedRect: bounds,
cornerRadius: cornerRadius
).cgPath
// Use cornerRadius directly simpler and works in current iOS 26 betas.
// CAShapeLayer mask was unreliable with UIGlassEffect in some beta versions.
glassView.layer.cornerRadius = cornerRadius
return
}

View File

@@ -823,3 +823,4 @@ private struct ClassicSwipeActionsModifier: ViewModifier {
ChatListView(isSearchActive: .constant(true), isDetailPresented: .constant(false))
.preferredColorScheme(.dark)
}