3 Nächsten Termine Mo., 06.05.2019: ObjektForum „Reaktive Programmierung in verständlichen Worten“ Alex Krause, QAware 06. bis 08.11.2019: XP Days Germany
15 Xcode Groups • Helps to keep structure • Should not contain „too many“ files • Should match the file system structure • Less of a problem since Xcode 9 • Keep filesystem in sync with Xcode: Synx (unmaintained!) • Generate Xcode Project: XcodeGen • In order to fulfill a task, you shouldn‘t be forced to open more than a few groups
Experts in agile software engineering 18 All in Assets.xcassets Issues: • It‘s gonna get messy. • Where is the asset used? Empfehlung: Assets, die nur innerhalb eines Moduls verwendet wird, gehören dorthin
Experts in agile software engineering 19 All in Assets.xcassets Issues: • It‘s gonna get messy. • Where is the asset used? Recommendation: • Assets, which are only used in one module, belongs there. (high cohesion)
Strings • All in Localizable.strings • It‘s gonna get messy. • Missing context Recommendation: • Strings, which are only used within one module, belongs there (high cohesion) • Use constants for the NSLocalizedString, not the keys! • Which l10n workflow is used? 23
l10n workflow • What is translated? • .strings files • XLIFF (XML Localization Interchange File Format) • Where is the source of the translation? • In the base .strings files? • In the code? 24
• Strings are declared in the module in which they are needed ! • But: I do not need the translations during development " • *.strings have to be placed within the module, because there is the source of the translation 26
• Strings are declared in the module in which they are needed ! • But: I do not need the translations during development " • *.strings have to be placed within the module, because there is the source of the translation 27
• Strings are declared in the module in which they are needed ! • Source of the translation is placed nearby the declaration ! • The translations can be placed outside the module ! 28
engineering BUT: In the XLIFF, the path to the strings-file is wrong ! • Export doesn‘t contain translations • Import won‘t work Workaround: • Assign the strings-file to the main target during export / import
String-based APIs • Localizable Strings und R.swift • Kommentare werden (noch) nicht übernommen (Github #342) • Stringdicts werden unterstützt aber noch nicht NSStringVariableWidthRuleType (Github #392) 40
Even the simple case can easily go wrong 43 UI Business / Domain Data Access Wrong or half-hearted implementation! Why? • Missing orientation • Blindly followed Medium-Articels about VIPER
From layers to onions 44 UI Business / Domain Data Access UI Business / Domain Data Access Domain Services UI SOLID? DIP? Lesenswert: https://www.maibornwolff.de/blog/von-schichten-zu-ringen-hexagonale-architekturen-erklaert
Tests • Don‘t cheat yourself • Don‘t use your productive AppDelegate in your tests • Write useful asserts • … • Don‘t write your mocks by hand • This implies you use mocks ;-) • Every programmer has it‘s own style writing mocks à chaos • Generate your mocks with a tool like SwiftyMocky 50
Tests • Don‘t cheat yourself • Don‘t use your productive AppDelegate in your tests • Write useful asserts • … • Don‘t write your mocks by hand • This implies you use mocks ;-) • Every programmer has it‘s own style writing mocks à chaos • Generate your mocks with a tool like SwiftyMocky 53