Simplify your life: build apps from reusable libraries

Simplify your life: build apps from reusable libraries

6e39a16132f9e41e6869527ba0ced276?s=128

vashchenko

October 06, 2018
Tweet

Transcript

  1. Simplify your life: build apps from reusable libraries

  2. Julia Vashchenko C++ macOS developer

  3. –Steve McConnell, 'Code Complete' “Managing complexity is the most important

    technical topic in software development.”
  4. None
  5. None
  6. None
  7. Versus Quiz

  8. Versus Quiz

  9. Library Framework

  10. None
  11. Inversion of Control Conceptual difference Martin Fowler on Frameworks and

    Inversion of Control:
  12. None
  13. None
  14. None
  15. None
  16. FRAMEWORK CONTROLS YOU

  17. Library Framework Technical difference

  18. Library Framework Technical difference

  19. Explicit Dependencies in Xcode Implicit

  20. Explicit Dependencies

  21. Implicit Dependencies

  22. Static Dynamic libraries

  23. Static Dynamic

  24. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows
  25. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows
  26. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary
  27. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary
  28. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger
  29. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller
  30. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower
  31. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster
  32. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time
  33. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time at run time
  34. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time at run time Library Update Mechanism rebuild host application
  35. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time at run time Library Update Mechanism rebuild host application updates separately
  36. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time at run time Library Update Mechanism rebuild host application updates separately Usage in Playgrounds can't be used
  37. Static Dynamic File extension .a on Linux, macOS, iOS .lib

    on Windows .dylib on macOS, iOS .so on Linux .dll on Windows Compilation INTO binary OUTSIDE the binary Binary Size bigger smaller Application Load Time slower faster Binding Symbols at link time at run time Library Update Mechanism rebuild host application updates separately Usage in Playgrounds can't be used is used
  38. None
  39. LLVM Clang

  40. compiler backend compiler frontend LLVM Clang

  41. C, C++, Objective-C, Objective-C++ LLVM Clang

  42. ActionScript, Ada, C, C#, C++, Common Lisp, Crystal, CUDA, D,

    Delphi, Fortran, Graphical G Programming Language, Halide, Haskell, Java bytecode, Julia, Kotlin, Lua, Objective-C, OpenGL Shading Language, Pony, Python, R, Ruby, Rust, Scala, Swift, Xojo LLVM Clang C, C++, Objective-C, Objective-C++
  43. ActionScript, Ada, C, C#, C++, Common Lisp, Crystal, CUDA, D,

    Delphi, Fortran, Graphical G Programming Language, Halide, Haskell, Java bytecode, Julia, Kotlin, Lua, Objective-C, OpenGL Shading Language, Pony, Python, R, Ruby, Rust, Scala, Swift, Xojo LLVM Clang C, C++, Objective-C, Objective-C++
  44. Compiling Linking

  45. Compiling Linking +

  46. Compiling Linking + Headers ↓

  47. Compiling Linking + Headers Object files ↓ ↓

  48. #include #import @import

  49. Modules

  50. What languages support modules?

  51. C++ Ada Julia Swift JavaScript Objective-C Python IBM/360 Assembler Perl

    C# Haskell Ruby Pascal Turbo Pascal Clojure Java
  52. C++ Ada Julia Swift JavaScript Objective-C Python IBM/360 Assembler Perl

    C# Haskell Ruby Pascal Turbo Pascal Clojure Java
  53. C++ Ada Julia Swift JavaScript Objective-C Python IBM/360 Assembler Perl

    C# Haskell Ruby Pascal Turbo Pascal Clojure Java
  54. Swift module Clang module

  55. Swift module Clang module

  56. Swift module Clang module

  57. How to manage lib updates

  58. How to manage lib updates • do not manage

  59. How to manage lib updates • do not manage •

    via Swift Package Manager: depend on private repo
  60. How to manage lib updates • do not manage •

    via Swift Package Manager: depend on private repo • via CocoaPods: Private Pod
  61. How to manage lib updates • do not manage •

    via Swift Package Manager: depend on private repo • via CocoaPods: Private or Local Pod • via Git Submodule
  62. Swift Package Manager Using GitHub Deploy Key Package.swift: Type in

    Terminal:
  63. Swift Package Manager Using GitHub Deploy Key Config file contents:

    GitHub.com → Your Profile → Repositories → Settings → Deploy Keys → Add deploy key → paste public key → check ‘Allow write access’
  64. CocoaPods Using Private&Local Pods

  65. CocoaPods Using Private&Local Pods 17:30 Modularizing your iOS apps

  66. Git Submodules

  67. Git Submodules

  68. Building Swift module in Xcode

  69. Building Swift module in Xcode

  70. Building Swift module without Xcode

  71. Building Swift module without Xcode

  72. Demo: Making & Using a Framework

  73. Troubleshooting common problems

  74. Error type Check: Compilation error HEADER_SEARCH_PATHS Xcode doesn’t build subproject

    Implicit Dependencies in ‘Schemes’ should be checked Linker error 1. Is there a function with exact name? 2. Is is implemented? Xcode can’t find a built library LIBRARIES_SEARCH_PATHS Static library doesn’t work for simulator Use lipo tool to add missing architecture
  75. Thank you jula.vashchenko@yahoo.com