Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 04 2021 07:46
    jasperblues commented #609
  • Jan 04 2021 07:27
    ingemarson commented #609
  • Dec 23 2020 11:40
    jasperblues closed #609
  • Dec 23 2020 11:40
    jasperblues commented #609
  • Dec 23 2020 11:19
    jasperblues closed #578
  • Dec 23 2020 11:19
    jasperblues commented #578
  • Dec 23 2020 11:13
    jasperblues closed #500
  • Dec 23 2020 11:13
    jasperblues commented #500
  • Dec 23 2020 11:10
    jasperblues closed #288
  • Dec 23 2020 11:10
    jasperblues commented #288
  • Dec 23 2020 11:10
    jasperblues closed #380
  • Dec 23 2020 11:09
    jasperblues commented #380
  • Dec 23 2020 11:09
    jasperblues commented #558
  • Dec 23 2020 11:08
    jasperblues closed #558
  • Dec 23 2020 11:08
    jasperblues commented #558
  • Dec 23 2020 11:06
    jasperblues closed #450
  • Dec 23 2020 11:05
    jasperblues closed #429
  • Dec 23 2020 11:04
    jasperblues closed #357
  • Dec 23 2020 11:04
    jasperblues closed #164
  • Dec 23 2020 11:03
    jasperblues commented #609
Jasper Blues
@jasperblues
its not clear if “pure” swift will ever have this. . . (maybe apple are keeping it lean and mean for embedded IoT applications?)
But it would be nicer if a protocol could be marked ‘dynamic’ rather than ‘@objc’ as the latter implies “legacy”
Hey I saw you have a questin on your Typohon tutorials.
Jeff Roberts
@JeffBNimble
Where? I don't see any questions. BTW, I'm working on a Swift 2 version of the same app using Typhoon in Swift. Will be adding videos on that app as well.
Jasper Blues
@jasperblues
First landing page, comments. Viewer asking where to find source.
Jeff Roberts
@JeffBNimble
Got it, thanks. I find it odd that I did not get an e-mail notifying me of the comment.
Jasper Blues
@jasperblues
Yeah, strange. How’s Swift 2 going? I saw this on StackOverflow just now
seems a hot topic lately.
I should open an issue with APple to change @objc on protocols to dynamic
Jeff Roberts
@JeffBNimble
I have finally completed the Swift 2 version of my League of Legends champion browser. It uses Typhoon and can be considered a sample of using Typhoon with Swift 2. Check it out here: https://github.com/JeffBNimble/LoLBookOfChampions-swift2-sqlite
I'd love some feedback from anyone, especially Jasper and other Typhoon collaborators
Jasper Blues
@jasperblues
Great work Jeff. Looks good.
Its nice to see an example of Typhoon with Swift 2. . . one of the features users have had trouble with is with Swift 2 style exception handling. Did you have develop any recommended standard approach for that with Typhoon?
Jeff Roberts
@JeffBNimble
I had a number of problems related to Typhoon and Swift 2, all of which stem from trying to inject classes/protocols that could not be annotated as @objc or subclass NSObject and therefore could not participate in Dependency Injection in the normal way. I did not encounter any issues with Typhoon in regards to throwing functions. I did design API's using "throws", but did not reference any of them in Typhoon. Are you referring to invoking failable initializers or calling throwing functions from Typhoon?
Jeff Roberts
@JeffBNimble
For code I could control since I wrote it, I chose not to change my API so that the classes could participate in Dependency Injection in the normal way. One of the protocols in one of the frameworks I wrote that is used by the app is this : https://github.com/JeffBNimble/swift-protocols-sqlite/blob/master/SwiftProtocolsSQLite/database/SQLiteDatabase.swift. Notice all of the throws functions. Because of those, Swift 2 cannot represent this protocol as an Objective-C protocol. I chose not to convert my API since I designed it with throws in the first place. This led to Typhoon problems.
In another case, look at this code: https://github.com/JeffBNimble/LoLBookOfChampions-swift2-sqlite/blob/master/LoLBookOfChampions/module/ApplicationAssembly.swift#L14. I was trying to inject ReactiveCocoa Schedulers. Schedulers are from the ReactiveCocoa library/framework, which I could not alter and I essentially had the same issue. This led to some unfortunate approaches/code as you can see. I chose to make those particular things global since I was unable to inject them and I needed them in multiple places. I would love feedback and discussion about this since I'm not happy with the choices.
Jasper Blues
@jasperblues
Yeah this is not satisfactory. By the sound of things we can’t recomment Typhoon with Swift 2.
We’ll have to come up with another approach to DI in Swift that doesn’t rely on the ObjC runtime.
Options:
  • Just use the DI pattern with no container/lib
  • Develop a new framework that uses compile-time instrumentation rather than runtime.
Jeff Roberts
@JeffBNimble
For the most part, Typhoon worked as it should. For the Objective-C version of the app, I was able to do everything I needed and not have to make any changes due to limitations in the language. However, with Swift 2, that was not the case. I encountered a handful of things I simply could not do with Typhoon. Again, not because of Typhoon, but because of Swift 2.
Jasper Blues
@jasperblues
Sure, but I wouldn’t recommend Typhoon + Swift 2 as a good combo.
When Swift 1.0 came out we were concerned but hopeful the language would become more dynamic.
But it seems to be moving away from ObjC interoperability.
So the approach to DI will need to be different.
A solution based on the ObjC runtime seems to impose limitations
Jasper Blues
@jasperblues
I’ll discuss with other devs before we make an official recommendation.
Roman Temchenko
@iThinker
Hi guys. If I want to make some factory methods that return same object class but with different configurations, will I be able to do it
?
What will happen in such case?
Jasper Blues
@jasperblues
you mean methods on TyphoonAssembly?
Roman Temchenko
@iThinker
Yes.
Jasper Blues
@jasperblues
Yeah, this is no problem with Typhoon.
Roman Temchenko
@iThinker
  • (Class)object; - (Class)object1;
Jasper Blues
@jasperblues
One of the reasons for creating Typhoon was that other DI containers struggle with this.
Roman Temchenko
@iThinker
How will it resolve dependencies if then I instantiate [Class new] somewhere in code?
Jasper Blues
@jasperblues
Typhoon is a DI container so you should obtain your built instance from Typhoon. . . via the assembly interface.
Take a look at the Quick Start for example.
Roman Temchenko
@iThinker
Oh. Do you mean that having [Class new] objects fully configured is a side effect?
Yeah. I've seen it.
And I've looked at some 3rd paty videos.
I am just not familiar with DI
Jasper Blues
@jasperblues
No. Typhoon won’t touch you class unless you ask for it from Typhoon.
Roman Temchenko
@iThinker
YOu know, we don't have it usually in iOS .:D
Jasper Blues
@jasperblues
DI is a common design pattern. And it applies in all OO languages. . . (though some, eg Ruby, tend not to use/need a library to manage it).
Once you understand DI you’ll have another tool for solving problems.