قالب وردپرس درنا توس
Home / IOS Development / # 300: Terminology 101 🎓 – Small pieces of cocoa

# 300: Terminology 101 🎓 – Small pieces of cocoa



Subjects

Issues

Recognizing and Understanding New Terms can be a big challenge when we try to grow as creators.

Often an unknown term or sentence may make us feel inexperienced, or ask "Should I already know this?"

( Pro Tip: No, you should not. Everyone is learning new things all the time. That's the whole point. Continue!)

Today begins we try to identify and shed light on some of the more opaque terms or the sentences we can come across when we learn to build our apps .

We will approach them from iOS / macOS developers, but Terms can even be used to describe things on just about any platform.

Let's begin!

Dependency Injection

We start with a classic. This is one of the finest names of one of the simplest concepts.

This is just a complicated way to describe the idea of ​​making some type or items while passing any other type or item ] that the first type is dependent on to perform its work. [1

9659000] Here is a super easy example:

  class [19659016] PlacesViewController  :    UIViewController   {
    la    leader :    PlacesManager 

    init    leader :    Places 
  ]   
     
     itself .   manager    =    manager 
  } 
} 

Notice how we enter manager instead of accessing any PlacesManager. shared example .

This technique has many implications, the most common being around testing . [19659000] By passing "addiction" we give us the chance to pass in a "mock" version that can behave in anticipated ways.

By not using shared instances we reduce global / shared state in our apps .

Singleton

This is simple and we are really only

A "singleton" is just a fancy word for a shared example

… which is just a fancy sentence for a thing that is created once and once. They are usually longevity and available globally through some sort of Thing.shared static property .

We covered more about singletones back in Bite # 4.

Modules

This is a fun. A Swift "Module" describes the code unit that constitutes an app or framework .

Sometimes we use a module's name as a prefix to collate the type name. As this:

  // in SailingKit.framework 
  struct    Ship   {   init  ()   { }  } 
  //     {    ()   { }  } 
  // i and App: 

     SailingKit 
  import    ] SpaceshipsKit 

  FUNC    someFunction  ()   {
    la    ship1    =    SailingKit . [  () 
    la    skip2    =    SpaceshipsKit .   Ship  () 
} 

Tests

Finally we will complete tests . Testing itself is a simple concept:

We write some code that does not enter our app . It calls the code we wrote in our app and verifies its output to ensure it works as expected.

Terms come into play when we start trying to describe types by tests .

Device Test

These types of tests are usually targeted to a small single piece of code.

For example, we could call a function that calculates some CGRects for a layout based on a given available container width. We will then check that CGRects had expected values.

For these reasons, "Unit" testing libraries tend to provide low-ranking assertions to ensure (for example) return values ​​are what we expect.

Integration / UI Tests

These are generally slightly more wide. They tend to target code that is closer to the user's actual behavior or interactions in the app.

On iOS / macOS these are also often referred to as "UI" tests since this is the name Apple gives the feature in Xcode we use to to resemble a user who walks around in our app . Pro Tip: Learn more "UI" Testing In These Bits

Unlike "Device Testing" Libraries, "Integration Testing " Libraries tend to provide tools to copy user behavior. Tapping buttons, fill box and general app usage.

It's all for today, we continue to explore more of these terms in the future Bites !

] Is there one you want to see more about here on LBOC ? You can share it with hello@littlebitesofcocoa.com!

Author's Note: 300 Pieces! Never in my wildest dreams I could have imagined LBOC to be such a success. My sincere thanks go to everyone who continues to read and subscribe every day, as well as the team at Spec and all our wonderful sponsors who do this all. Here's for the next 300!


Source link