little2s / NoChat

A lightweight chat UI framework for iOS.
591 stars 66 forks source link

swift 3 support #11

Closed anupamme closed 7 years ago

anupamme commented 8 years ago

Hello,

Is the support for swift 3 in pipeline?

Thanks

little2s commented 8 years ago

@anupamme Sorry for answer you so late. Yeah, it will support swift 3.

mbalex99 commented 7 years ago

@little2s Is this project on Swift 3.0 right now? Or is that just a plan for the future? For clarification there is no Swift 3.0 at the moment.

mbalex99 commented 7 years ago

@anupamme and @little2s I made a pull request that migrated it over to Swift 3.

It was extremely hard, but I think I learned a lot of swift.

Until @little2s reviews and merges my pull request you can do this in your Podfile

pod 'NoChat', :git => 'https://github.com/mbalex99/NoChat'
anupamme commented 7 years ago

@mbalex99 I tried your code but I am not able to compile Demo project. I am getting various swift 3 errors.

My pod file looks like this:

platform :ios, '10.1' 2 use_frameworks! 3 4 target 'Demo' do 5 pod 'NoChat', :git => 'https://github.com/mbalex99/NoChat' 6 pod 'NoChatTG', :path => "../" 7 pod 'NoChatMM', :path => "../" 8 pod 'NoChatSLK', :path => "../" 9 end

Xcode version: 8.1 beta

Can you try it at your end and see whether it works. Also, will changing from 8.1 beta to 8 help?

mbalex99 commented 7 years ago

That I'm not too sure about XCode 8.1. I really don't like mixing and matching XCode versions, I've had terrible experiences on my end from it and stick to the stable that is encourage by the AppStore for Mac.

I'm using the latest stable of XCode 8. What are the errors?

Maximilian Alexander mbalex99@gmail.com www.maxofeden.com

anupamme commented 7 years ago

I could compile the Demo app with some changes. They were not hard to do - I can attach code diff or do a pull request.

However, when I run the demo project on phone running ios 10.1, I get following error when I click either Slack/We Chat/Telegram:

2016-09-22 15:55:31.086352 Demo[856:162566] * Assertion failure in -[UICollectionViewLayoutAttributes setFrame:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.5.2/UICollectionViewLayout.m:229 2016-09-22 15:55:31.090817 Demo[856:162566] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionViewLayoutAttributes: -setFrame: with CGRectNull is undefined.'

So are you able to run Demo project on your phone? (with Xcode 8)

mbalex99 commented 7 years ago

Yes I'm using Version 8.0 (8A218a)

I deleted, it cloned, it and even used in my own project. The Demo project works fine with me. @little2s or @lfarah maybe you guys can try it out and see what it's doing.

anupamme commented 7 years ago

I tried using version 8.0 (8A218a)

I am not able to resolve a compile error which comes in file TextBubbleView.swift which is present under

Pods/Development Pods/NoChatMM/NoChatMM/Source Pods/Development Pods/NoChatSLK/NoChatSLK/Source Pods/Development Pods/NoChatTG/NoChatTG/Source

In the method

internal func == (lhs: TextBubbleLayoutModel.LayoutContext, rhs: TextBubbleLayoutModel.LayoutContext) -> Bool

I get compile error when the scope of == is any of these internal, fileprivate and private. I get different errors in each of them.

internal: Function cannot be declared internal because its parameter uses a fileprivate type

fileprivate: Method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatable'

private: Method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatable'

Can you suggest how did you resolve this?

mbalex99 commented 7 years ago

I'll take a look tonight! On Thu, Sep 22, 2016 at 12:16 PM Anupam Mediratta notifications@github.com wrote:

I tried using version 8.0 (8A218a)

I am not able to resolve a compile error which comes in file TextBubbleView.swift which is present under

Pods/Development Pods/NoChatMM/NoChatMM/Source Pods/Development Pods/NoChatSLK/NoChatSLK/Source Pods/Development Pods/NoChatTG/NoChatTG/Source

In the method

internal func == (lhs: TextBubbleLayoutModel.LayoutContext, rhs: TextBubbleLayoutModel.LayoutContext) -> Bool

I get compile error when the scope of == is any of these internal, fileprivate and private. I get different errors in each of them.

internal: Function cannot be declared internal because its parameter uses a fileprivate type

fileprivate: Method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatable'

private: Method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatable'

Can you suggest how did you resolve this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/little2s/NoChat/issues/11#issuecomment-249001177, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFSMQRWB1LhsrNC3kXQZxVn3iTTUZmvks5qstQhgaJpZM4JlG21 .

Maximilian Alexander mbalex99@gmail.com www.maxofeden.com

anupamme commented 7 years ago

@mbalex99 did you get a chance to look at it?

mbalex99 commented 7 years ago

Hey man I'm sorry I got super swamped. I'll hopefully take a look in the morning. On Sat, Sep 24, 2016 at 8:50 AM Anupam Mediratta notifications@github.com wrote:

@mbalex99 https://github.com/mbalex99 did you get a chance to look at it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/little2s/NoChat/issues/11#issuecomment-249371700, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFSMcmOmLK27ZnuUU2zwlzzCdcUtK1Mks5qtUbdgaJpZM4JlG21 .

Maximilian Alexander mbalex99@gmail.com www.maxofeden.com

anupamme commented 7 years ago

I cloned the repo on your github which is: https://github.com/mbalex99/NoChat

And I tried running Demo app in emulator (in xcode 8) but when I click Telegram row I get following error (it is not formatted but I dont know how to present this in a better format):

UIKit_Sim/UIKit-3599.6/UICollectionViewLayout.m:229 2016-09-29 20:07:58.969 Demo[62239:4418114] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionViewLayoutAttributes: -setFrame: with CGRectNull is undefined.' * First throw call stack: ( 0 CoreFoundation 0x000000010e20b34b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010dc6c21e objc_exception_throw + 48 2 CoreFoundation 0x000000010e20f442 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010d802edd -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UIKit 0x000000010f6b2f8d -[UICollectionViewLayoutAttributes setFrame:] + 567 5 NoChat 0x000000010d3d959e _TZFV6NoChat29ChatCollectionViewLayoutModel11createModelfTV12CoreGraphics7CGFloat15itemsLayoutDataGSaT6heightS212bottomMarginS2____S0 + 846 6 NoChat 0x000000010d3e71ba _TFFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549417createLayoutModelFTGSaVS_17DecoratedChatItem_19collectionViewWidthV12CoreGraphics7CGFloat_VS_29ChatCollectionViewLayoutModelL_17createLayoutModelfT22intermediateLayoutDataGSaT6heightGSqS312bottomMarginS3__S4_ + 554 7 NoChat 0x000000010d3ddf3e _TFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549417createLayoutModelfTGSaVS_17DecoratedChatItem_19collectionViewWidthV12CoreGraphics7CGFloat_VS_29ChatCollectionViewLayoutModel + 3854 8 NoChat 0x000000010d3e5303 _TFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549418createModelUpdatesfT8newItemsGSaPS_16ChatItemProtocol__8oldItemsGSaPS1___19collectionViewWidthV12CoreGraphics7CGFloat_T7changesVS_17CollectionChanges18updateModelClosureFT_T + 1363 9 NoChat 0x000000010d3e4c1e _TFFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549412updateModelsFT8newItemsGSaPS_16ChatItemProtocol8oldItemsGSaPS1_7contextOS0_13UpdateContext10completionFT_TT_U0_FT_T7changesVS_17CollectionChanges18updateModelClosureFT_T + 110 10 NoChat 0x000000010d3e4d9b _TPATFFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549412updateModelsFT8newItemsGSaPS_16ChatItemProtocol8oldItemsGSaPS1_7contextOS0_13UpdateContext10completionFT_T__T_U0_FT_T7changesVS_17CollectionChanges18updateModelClosureFT_T + 139 11 NoChat 0x000000010d3df1f8 _TFC6NoChat18ChatViewControllerP33_FFD740400D01333E54A5CD93444A549412updateModelsfT8newItemsGSaPS_16ChatItemProtocol8oldItemsGSaPS1_7contextOS0_13UpdateContext10completionFT_TT_ + 1416 12 NoChat 0x000000010d3dea4a _TFFC6NoChat18ChatViewController18enqueueModelUpdateFT7contextOS0_13UpdateContext_T_U_FFT_TT + 538 13 NoChat 0x000000010d4016a5 _TTRXFo_oXFo___XFo_iXFo_iTiT_iT + 117 14 NoChat 0x000000010d401741 _TPATTRXFo_oXFo___XFo_iXFo_iT_iTiT + 81 15 NoChat 0x000000010d401932 _TFC6NoChat15SerialTaskQueueP33_60A2C46ADC06B4886CEDB318BA5824F920maybeExecuteNextTaskfTT + 418 16 NoChat 0x000000010d401965 _TFC6NoChat15SerialTaskQueue5startfTT + 21 17 NoChat 0x000000010d401c2b _TTWC6NoChat15SerialTaskQueueS_23SerialTaskQueueProtocolS_FS1_5startfTT + 43 18 NoChat 0x000000010d3f5f9a _TFC6NoChat18ChatViewController21viewDidLayoutSubviewsfTT + 186 19 NoChat 0x000000010d3f6002 _TToFC6NoChat18ChatViewController21viewDidLayoutSubviewsfTT + 34 20 UIKit 0x000000010ee033a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1337 21 QuartzCore 0x00000001145e2cdc -[CALayer layoutSublayers] + 146 22 QuartzCore 0x00000001145d67a0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 23 QuartzCore 0x00000001145d661e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 24 QuartzCore 0x000000011456462c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 25 QuartzCore 0x0000000114591713 _ZN2CA11Transaction6commitEv + 475 26 UIKit 0x000000010ed69878 _afterCACommitHandler + 346 27 CoreFoundation 0x000000010e1afe17 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 28 CoreFoundation 0x000000010e1afd87 CFRunLoopDoObservers + 391 29 CoreFoundation 0x000000010e194b9e __CFRunLoopRun + 1198 30 CoreFoundation 0x000000010e194494 CFRunLoopRunSpecific + 420 31 GraphicsServices 0x0000000113df2a6f GSEventRunModal + 161 32 UIKit 0x000000010ed3ef34 UIApplicationMain + 159 33 Demo 0x000000010d2ffd6f main + 111 34 libdyld.dylib 0x0000000111f4568d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

mbalex99 commented 7 years ago

Hey @anupamme I can't at all replicate that error... So sorry. Does anyone else know what could be the issue?

vzheng56 commented 7 years ago

After two month, this framework did not support swift 3.

lkaihua commented 7 years ago

加油啊,早日支持Swift 3!

Duansoft commented 7 years ago

I am trying to use https://github.com/mbalex99/NoChat. Also face to anupamme's issue in xcode 8.0. Can you offer solution? *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionViewLayoutAttributes: -setFrame: with CGRectNull is undefined.'

yarodevuci commented 7 years ago

Still no Swift 3.....

Duansoft commented 7 years ago

pod 'NoChat', :git => 'https://github.com/mbalex99/NoChat' It works well in xcode8.0 and xcode8.1 Just have a little issue and after fix it, can use it

mbalex99 commented 7 years ago

What was the issue with my fork @DuanSoft?

On Wed, Dec 7, 2016 at 11:40 PM Duansoft notifications@github.com wrote:

pod 'NoChat', :git => 'https://github.com/mbalex99/NoChat'

It works well in xcode8.0 and xcode8.1 Just have a little issue and after fix it, can use it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/little2s/NoChat/issues/11#issuecomment-265673661, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFSMWNMp8KXOSTHt6pag-dWyTBxaoeQks5rF7RfgaJpZM4JlG21 .

-- Maximilian Alexander mbalex99@gmail.com www.maxofeden.com

Duansoft commented 7 years ago

Thanks for your update mbalex99. Demo App works well in xcode8.0, 8.1. Please check this image. 2016-12-09 at 17-24-14 How can I fix it?

Thanks

mbalex99 commented 7 years ago

This one seems easy. It's the calculate layout logic inside of TextMessageView* classes

Sent from my iPhone

On Dec 9, 2016, at 6:27 AM, Duansoft notifications@github.com wrote:

Thanks for your update mbalex99. Demo App works well in xcode8.0, 8.1. Please check this image.

How can I fix it?

Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

JT501 commented 7 years ago

@mbalex99 , hello I figured out that the new UICollectionView Prefetching function in iOS10 will make the library crash when scrolling the Messages View.

Therefore, I disable it to fix the crash.

I have made a pull request to you. Feel free to merge it. Thank you. 😄

mbalex99 commented 7 years ago

Awesome thanks I'll do it tonight On Mon, Jan 23, 2017 at 7:06 PM hallelujahbaby notifications@github.com wrote:

@mbalex99 https://github.com/mbalex99 , hello I figured out that the new UICollectionView Prefetching function in iOS10 will make the library crash when scrolling the Messages View.

Therefore, I disable it to fix the crash.

I have made a pull request to you. Feel free to merge it. Thank you. 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/little2s/NoChat/issues/11#issuecomment-274688828, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFSMcf9QdExiaY0MvqJaon1QFikzpsfks5rVWqwgaJpZM4JlG21 .

-- Maximilian Alexander mbalex99@gmail.com www.maxofeden.com

little2s commented 7 years ago

This lib rewrite with Objective-C now, the examples show how to use with both Objective-C and Swift 3.