Posts

Post not yet marked as solved
1 Replies
202 Views
What works so far In a game I am displaying a number to the user with some code like this: Text("\(model.product)") I want Text to have an interesting transition happen each time model.product changes. To arrange this I've used the id hack: Text("\(model.product)") .id(model.product) // Transition here is included at the end of the post. .transition(.explodeUp) So now, in effect, each time the model.product changes, any existing Text showing the old product is removed (with a transition) and a new Text view is inserted to show the new product (with a transition). So far, this works nicely, I've got my Transition all tweaked up, and it's a pretty nice effect [attached at the end]. Cool bananas! What I want though While this is nice as it is, not all model.product changes are alike… The existing code uses the same transition regardless of how product.model has changed. What I want is for the transition used to depend on how product.model has changed. FWIW, I actually want to vary the transition depending on why product.model has changed, but I can accomplish this in the model I think, so it seems unimportant to the SwiftUI side. The current transition is great for when the number increases. I want to use something else if the number decreases (probably called AnyTransition.dropDown or something). I'd like to be able to look at the old and new values of model.product and choose between two different transitions depending on whether the value has increased or decreased. Looking at the Transition protocol, and Transaction, this seems like it probably ought to be possible to do this. I think I'd certainly want to stop using the id hack. Instead perhaps I could have an extension on View which would read like this at the usage site… Text(model.product) .replacingWithTransitionOnChanges(of: model.product) { oldValue, newValue in oldValue < newValue ? .explodeUp : .dropDown } And the extension declaration would perhaps look like this: extension View { func replacingWithTransitionOnChanges<Value: Hashable>( of value: Value, _ transitionSource: (Value, Value) -> some Transition ) { // What in the name of fish cakes goes in here though? :-/ } } But as you see, I've got not a lot of an idea how I'd build the function. Yet? Any ideas for that? Or else – perhaps there are really easy ways to get this effect that I'm not thinking of? Thanks! The .explodeUp transition My transition declaration, if anyone is interested… extension AnyTransition { static var explodeUp: AnyTransition { .asymmetric( insertion: .scale(scale: 0.5) .combined(with: .opacity) .animation(.easeInOut(duration: 0.2)), removal: .scale(scale: 1.8) .combined(with: .opacity) .combined(with: .rotate(angle: .degrees(Double.random(in: -20..<20)))) .animation(.easeInOut(duration: 0.4)) ) } static func rotate(angle: Angle) -> AnyTransition { .modifier(active: RotateModifier(angle: angle), identity: RotateModifier(angle: .zero)) } }
Posted Last updated
.
Post not yet marked as solved
2 Replies
958 Views
In our test environments (only accessible over VPN), universal links have recently started to fail (for iOS 13, which doesn't use Apple's AASA CDN). I've captured a sysdiagnose to look at the swcd logs. I see entires for our private test domains that look like this (edited to redact domain details just in case): Service:              applinks App ID:               <<redacted>> App Version:          2101251821 Domain:               <<redacted>> User Approval:        unspecified Site/Fmwk Approval:   unspecified Flags:                 Last Checked:         2021-01-26 12:12:01 +0000 Next Check:           2021-01-26 15:17:37 +0000 Error:                Error Domain=SWCErrorDomain Code=100 "Disallowed trust result type." UserInfo={Line=174, Function=-[SWCSecurityGuard verifyTrust:error:], NSDebugDescription=Disallowed trust result type., TrustResultType=6} Retries:              1 I've done a little bit of digging for TrustResultType and I'm guessing that it might be a SecTrustResultType which is an enum. If this is the case then the error code is kSecTrustResultFatalTrustFailure - https://developer.apple.com/documentation/security/sectrustresulttype/ksectrustresultfataltrustfailure?language=objc. Digging a bit more, the only mentions that I can find such as this Apple doc - https://developer.apple.com/documentation/security/certificate_key_and_trust_services/trust/discovering_why_a_trust_evaluation_failed suggest that there is probably some kind of certificate issue. Am I right that this is probably a certificate issue? Is there any way to discover more about what swcd is troubled by (perhaps the function and line number in the error could be helpful)? I'd like to be able to find out more specifically what the issue is so I can point out infrastructure team in the direction of the cause. NB: if I try to directly open the AASA file at <redacted-domain>/.well-known/apple-app-site-association using a test iPhone on the VPN, I can open the file and it looks correct to me. However, perhaps Safari has less stringent certificate requirements than swcd? Thanks.
Posted Last updated
.
Post marked as solved
3 Replies
1.9k Views
I'm trying to fix some universal link issues. A number of posts here such as this one - https://developer.apple.com/forums/thread/96570 mention being able to use Console on an attached Mac to monitor swcd's on an iPhone test device. However, when I look in Console App and select my attached iPhone, I don't see any messages from swcd at all. Is there something I need to do to see these in Console? Or perhaps a more recent iOS has stopped logging swcd events (I'm using iOS 14 for this device). The only debugging of swcd I've managed to obtain is by obtaining a sysdiagnose. Thanks.
Posted Last updated
.