Post

Replies

Boosts

Views

Activity

CollectionView: Sync `center.y` of UIView outside collection view and a view in a cellinside
I have a setup: Collection view with compositional layout a self sizing cell inside a subview inside the cell and unrelated view outside the collection view I would like to: modify the layout (constraints) of the cell inside the collection view with UIView.animate trigger an animated layout update of collection view synchronize the position of an unrelated view to the position of one of the subviews of a collection view cell What I tried: UIView.animate(withDuration: 0.25) { cellViewReference.updateState(state: state, animated: false) collectionView.collectionViewLayout.invalidateLayout() collectionView.layoutIfNeeded() someOtherViewOutsideCollectionView.center = cellViewReference.getPositionOfThatOneViewInWindowCoordinateSystem() } What I'm expecting: after invalidateLayout, the layout update of the collection view is merely scheduled, but not yet performed layoutIfNeeded forces an update on the collectionViewLayout + update on the frames of the views inside the UICollectionViewCells all the frames become correct to what they will look like after the animation is performed I call getPositionOfThatOneViewInWindowCoordinateSystem and it gives me the position of the view after the uicollectionview AND the cell's layout has updated What happens instead: getPositionOfThatOneViewInWindowCoordinateSystem returns me an old value I am observing that the bounds of the cell didn't actually change during layoutIfNeeded And moreover, the bounds change without animation, instantly Question: how to animate self sizing cell size change due relayout how to synchronize outside views with collection views
0
0
75
3d
How to single-object prelink a framework?
My situation: I am developing a dynamically linked framework called A, wrapped into .xcframework I depend upon other frameworks B and C that are linked statically However, I don't want the consumers of A to learn about the existence of B and C And because of this, I would like to perform single object pre-link during the linkage of A so that B and C are totally consumed by A and are to be never seen again. This task would be relatively easy if instead of static frameworks (.framework), I used static libraries (.a). In this case, I would be able to easily plop the path to the .a into the Prelink Libraries setting, set Perform Single-Object Prelink to YES, disable the embedding - and the goal would be accomplished. However, I am facing the linkage against frameworks, not libs. The problem is that it has resources and bundles inside of it. If I put a path to the .xcframework or .framework into the Prelink Libraries Build Setting, the build fails: Command MasterObjectLink failed with a nonzero exit code can't map file, errno=22 file '/Users/*****/B/B.xcframework/ios-arm64/B.framework' And if I put a path to the actual executable inside the framework (B.xcframework/ios-arm64/B.framework/B), the build succeeds. However, none of the resources of B.framework are present in the resulting output. Is there a way to automatically copy resources during Single-Object Prelink?
1
0
915
May ’23
How to statically link a Swift framework to a Swift framework?
I have 2 frameworks, which are both Swift Statically-linked frameworks. This means that my Mach-O Type is Static Library for both of the targets. One of the targets (A) depends on another target (B). I successfully archive A, and then I successfully archive B, linking against A. Embedding is enabled, however I don't seem to find any mentions of A in the exported build artifacts. However, when I import archived and exported B in another target, it gives me a compilation error: ld: warning: Could not find or use auto-linked framework 'A' Undefined symbols for architecture x86_64: "A.someMethodInsideA() -> Swift.Int", referenced from: B.someMethodInsideB() -> Swift.Int in B(B.o) ld: symbol(s) not found for architecture x86_64 You see, I set the A's Mach-O Type to Static Library, so I expect A's binaries to be completely embedded into B with static linkage, but this doesn't happen for some reason. How can I embed a static framework inside a static framework?
1
0
1.3k
Sep ’22
Use `merchantId` from another development team
I am developing an SDK that other apps will be integrating. In the SDK code base, I provide a billing user interface that features calls to the ApplePay. I would like to use my merchantId so that the payments get billed to my benefit. This is intended behavior and the integrators of the SDK will be fully aware of circumstance. At the same time, the integrators of my SDK also might have Apple Pay integrated into their own app. And they might have their own merchantId's that they created in their Apple Developer portal. Can they use my merchaintId, putting it into the entitlement so that my SDK integrated into their app will be using my merchantId to create Apple Pay payments while being a part of an app signed under a different Apple Development team?
2
0
1.7k
Sep ’21
What is the type of `async let` declaration?
I have a family of questions related to the new async/await and structured concurrency features in Swift. If we make an async let declaration, the Xcode reports the type of the declaration as the type that the object will have after it's been awaited for. I.E.: If we async let image = downloadImage() then if we inspect image, its type will be UIImage. Question #1: Is there a way to pass an async let declaration to a function as a parameter? I would like to have a function that accepts an async let declaration and transforms it somehow. The obvious way that comes to mind is to wrap the declaration into an async closure that includes an await of this declaration inside, but I wonder if there is a way to reference a type like Async<UIImage>, Task<UIImage> or something else so that an instance of this type could be declared as an async let Question #2: Why does the Xcode report the type of an async let as the type of value after an await instead of some metaphysical type representing the presence of "awaitable" context? Why isn't the type of async let displayed as Task<UIImage>? Why didn't the language go the ECMAScript path where an async function is supposed to return a Promise that can be both subscribed to and awaited?
1
0
1.5k
Jun ’21