drawRect / Instagram_Stories

Inspired by Instagram Stories functionality. This source is similar to Instagram Stories, which is having both image and video support.
MIT License
414 stars 76 forks source link

Bugfix/story collection view constraint #131

Closed tiskender2 closed 2 years ago

tiskender2 commented 2 years ago

PR Details bugfix for story preview

Description when next user story is visible by automatically and if you use iphone X and above, story cell's _view's top constraint is broken. I fixed it tested on ios 15

Motivation and Context Why is this change required? _view doesn't have constraint, calculating its height by screen size height, and its caused an issue on iphone X and above. What problem does it solve? i added constraint to (_view: IGStoryPreviewView) and problem Solved

ranmyfriend commented 2 years ago

Hi @tiskender2

I have cloned your changes from https://github.com/tiskender2/Instagram_Stories and branch bugfix/storyCollectionViewConstraint

Straightaway its crashing at IGStoryPreviewViewController at line no. 157

I used Xcode Version 13.1 (13A1030d) and iPhone Simulator 13Pro Max

I gotta crash from your changes, here is the crash debugger output and screenshot also i have attached.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSLayoutConstraint for <NSLayoutXAxisAnchor:0x6000035e4140 "InstagramStories.IGStoryPreviewView:0x7fb8d57397c0.leading">: A constraint cannot be made between <NSLayoutXAxisAnchor:0x6000035e4140 "InstagramStories.IGStoryPreviewView:0x7fb8d57397c0.leading"> and <NSLayoutXAxisAnchor:0x6000035e4780 "UILayoutGuide:0x600001981260'UIViewSafeAreaLayoutGuide'.left"> because their units are not compatible.'

Attached Screenshot of the crash.

Screenshot 2021-11-23 at 2 53 33 PM

Kindly revert us if you need any help,

Thanks, Ranjith

tiskender2 commented 2 years ago

hi @ranmyfriend i solved to problem by changing constraints thank you