JSQMessagesViewController icon indicating copy to clipboard operation
JSQMessagesViewController copied to clipboard

Working Swift example

Open Katafalkas opened this issue 11 years ago • 14 comments

Hey,

I am new to iOS development and have zero knowledge of Objective-C. Started Swift with Beta 6.0.1. So excuse me for silly questions.

This is an awesome project and would love to use it. As I seen from all FAQ's you don't seem like a big fans of Swift. After almost a day of experimenting and searching, I haven't really moved much. [Possibly I am just an idiot.].

As I can see from issues, people actually got it working with Swift. Is it possible to make some sort of working example ? Like you have Objective-C Demo in your repo ? I do assume you are all busy, so If you would somewhat help me with my sample I will try to write a demo for Swift.

I got up to this point. Swift does not show any errors in build. And all protocols seem to conform. But all I am seeing is blank page. https://gist.github.com/Katafalkas/8336d283a5ccc84a4ec4

Katafalkas avatar Dec 11 '14 22:12 Katafalkas

Thanks @Katafalkas !

On the contrary, I love Swift:

I would love to rewrite it in Swift eventually. We'll see what happens.

But, this was (obviously) written before Swift.

I think having a Swift demo project is a great idea. I'll see if I can get this ready by the next release.


Of course, pull-request for this are welcome.

For anyone here interested, I would like to see:

  1. An entirely new directory: Swift-Example/
  2. with a new local Podfile
  3. the Swift demo should be built similarly to the Objective-C one

jessesquires avatar Dec 12 '14 01:12 jessesquires

@Katafalkas - also, you may want to reach out to those in the community who have successfully used this with Swift.

List of issues mentioning Swift

jessesquires avatar Dec 12 '14 01:12 jessesquires

Ok. If you don't mind I will tag people here, who I assume got this working.

Hey @macdonjo @mschinis @nickoneill . By any chance you could share some working examples ?

Katafalkas avatar Dec 12 '14 08:12 Katafalkas

I got it working. I maintain Swift-Playground where I have implementations of multiple cool libraries. This one is one of them. Feel free to check it out.

mschinis avatar Dec 12 '14 08:12 mschinis

Thanks @mschinis !

jessesquires avatar Dec 30 '14 01:12 jessesquires

The folks at Firebase have also created this project, which is in swift and uses JSQMessagesViewController:

https://github.com/firebase/ios-swift-chat-example

marcgug avatar Dec 31 '14 02:12 marcgug

Thanks @ogoog ! :+1: :sunglasses:

jessesquires avatar Dec 31 '14 05:12 jessesquires

No worries @jessesquires :) Love your work. Keep at it! I will be improving my example to provide a better documentation as soon as I get the app I'm working on published on the AppStore :sunglasses: @ogoog That looks pretty awesome.

mschinis avatar Jan 01 '15 13:01 mschinis

I recommend taking a look at https://github.com/evermeer/EVCloudKitDao Not mine, but helped me fix the avatar issues I was struggling with.

francisjervis avatar Jan 15 '15 06:01 francisjervis

Are there any updates on this issue? I'm currently building in swift and unable to get anything to load. The View controller remains empty despite using the demos provided above.

jayisidoro avatar May 14 '15 23:05 jayisidoro

It works fine for me @jayisidoro.

On Fri, 15 May 2015 at 00:08 jayisidoro [email protected] wrote:

Are there any updates on this issue? I'm currently building in swift and unable to get anything to load. The View controller remains empty despite using the demos provided above.

— Reply to this email directly or view it on GitHub https://github.com/jessesquires/JSQMessagesViewController/issues/675#issuecomment-102196019 .

mschinis avatar May 15 '15 00:05 mschinis

@mschinis i tried yours and it didn't work(just the datasourcedelegate issue) but i copied the rest of your code and it was a great foundation! i just figured out how to get the tool bar to display along with messages being. However, i'm not able to adjust the height of the collectionview, nor the buttons on the navigation controller, or other arbitrary UI aspects. Is that something that needs to be done in the VC subclassing JSQMessagesVC or another location? thank you!

jayisidoro avatar May 15 '15 00:05 jayisidoro

My images came distorted after downloading in Background I solve it adding mediaView.contentMode = UIViewContentModeScaleAspectFit; in the JSQMessagesCollectionViewCell.m. Is this the right way to do it?

lguerra10 avatar Sep 07 '15 17:09 lguerra10

Replaced by #1608

jessesquires avatar May 30 '16 22:05 jessesquires