For loops in Swift – For-In, For-Case-In, Where, Stride And Sequence

Initially Swift contained C-style for loops just like
Objective-C, but because of a lack of usage C-style for loops were removed as
alternatively you can use the For-In, For-Case-Where-In,  Stride and Sequence keywords to accomplish the
same tasks.

For-In

The first example is the for-in loop which makes it very easy to iterate through data structures.  In this example we’ll go through an array:

// this example iterates through an array printing 1 2 3
let values = [1,2,3]
for x in values {
    print(x)
}

You can also easily go through number ranges using for-in as
below:

// these two examples iterate through a number range printing 1 2 3
for x in 1…3 {
    print(x)
}
for x in 1..<4 {
    print(x)
}

Going through dictionaries Is easy using for (key, value)
in:

// this example shows how to iterate through a dictionary
let keyValues = ["one": 1, "two": 2, "three": 3]
for (key, value) in keyValues {
    print("Key: \(key), Value: \(value)")
}

Where

Filtering can be adding using for-case-in and where like in this example where we only print odd numbers – notice you must add the let keyword:

// this example prints 1 3
// filters out the 2 which is an even number
for case let x in 1…3 where x % 2 > 0 {
    print(x)
}

You can omit the where statement when filtering out nil
values using optionals .some case like this:

// we can use some optionals to shorten this down using .some
// this example prints 1 2 3
let valuesWithNil = [1, nil, 2, nil, 3]
for case let .some(x) in valuesWithNil {
    print(x)
}

Now, what if you don’t want to go through each value – this is
where Stride and Sequence come in.

Stride

With stride you can iterate by a specific number like in these cases below where we will increase the value by 2 at each iteration – stride(from: in:) excludes the final value, and stride(from: in:) includes the final value:

// this example prints 1 3 5
// this is equivalent to c for loop statement
// for(x = 1; x < 7; x+=2)
for x in stride(from: 1, to: 7, by: 2) {
    print(x)
}

// this example prints 1 3 5 7
// for(x = 1; x <= 7; x+=2)
for x in stride(from: 1, through: 7, by: 2) {
    print(x)
}

Stride only allows you to go through the sequence using a
constant value, and this is where sequence comes in which we can use for more
complex cases. 

Sequence

Sequence allows usage of the ternary operator within a closure so we can iterate using some dynamic interval like in this example:

// This example doubles the x value at each iteration
// and prints 1 2 4 8
for x in sequence(first: 1, next: {$0 * 2 < 10 ? $0 * 2 : nil}) {
    print(x)
}

The $0 represents the first value passed to a closure and in this case represents the current value.

You can also combine sequence and stride with where for further filtering:

// this example shows how to combine a for-case-in statement
// with a sequence, this prints 1 2 8
for case let x in sequence(first: 1, next: {$0 * 2 < 10 ? $0 * 2 : nil}) where x != 4 {
    print(x)
}

As you can see using For-In, For-Case-In, Where, Stride And
Sequence allows us to create very complex for-loops without the need for the
standard C for loop.

Original article: For loops in Swift – For-In, For-Case-In, Where, Stride And Sequence

©2019 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Are you still thinking of starting your own web resource?

So, you could ask me about the best and cheapest hosting you can find. Therefore, today I’ll share my thoughts with you about 7 important aspects of quality web hosting. Let me tell about my experience and introduce you to Veesp.

After days of research on finding the ideal host for my project, I found out that it’s not always as easy as I used to think. First things first.

1. Requirements

Depending on your project, the server’s hardware and software requirements can be quite different. Analyze your needs carefully, and read on to have a better understanding of what your website may need.

2. Type of hosting

If you are creating a blog or a site based on WordPress, many people would actually recommend you a regular shared hosting plan or a special optimized WP hosting. There are also a lot of cloud hosting offers but many of them just are marketing tricks.

I’ve encountered a lot of scams, that’s why I always favor a simple VPS which I can easily manage from a control panel. The main difference between shared hosting and a virtual private server for me is that I’m not sharing any resources of my server with anybody and the price is often the same. Veesp has a wide range of Linux and Windows VPS, and all of them have KVM virtualization which is reliable and stable. Click here to Check out their SSD VPS.

If you are planning to make an e-commerce or a resource-demanding web project, a dedicated server is a much more favourable option.

Veesp also provides dedicated servers, but those are unmanaged servers, which means that you need to have sufficient knowledge or have an administrator in your team. Actually, sometimes it’s even cheaper to hire a specialist for the project and get an unmanaged server than buy a managed service.

And ultimately, you can create your own custom solution with the Veesp server constructor.

3. Tech support

What I liked a lot with Veesp is their support. While being a client of a big brand company can be hard to get any help when needed, Veesp support team always got back to me within one hour or less, efficiently solving issues that I had with my set up.

4. Uptime

Veesp has a very good uptime, and has in fact been rewarded with the HostAdvice Uptime Award.

5. HTTPS

Nowadays, you can get a SSL certificate right through your hosting provider which is a very good thing. Please refer to this article if you need more info about the process.

6. You can ask for a free trial and test it

You can choose any hosting provider and ask about a trial period – it should be free. Veesp has a 3-day trial. I ran a few tests to test my servers such as Apache Benchmark and JMeter and they went smoothly.

7. SLA and a money back guarantee

Finally, Veesp has a money back guarantee and they can refund your money if needed. What comes to myself, after five months of using it, I absolutely don’t regret my choice!

Good luck and Happy New Year!

This is a guest article by Vadim Eremeev.

How to Create Reverb Tail Effects

The main sounds and ideas that you present in a track are by far the most important for the success of that track. But the ear candy background elements provide that professional polish that allow the main elements to shine through in the best way possible. 

These effects can come anywhere from foley to effects samples. 

There is one effect, however, that ties a track together with the use of the sounds that you already have in the track. 

In this screencast, I’ll show you how to create reverb tail effects for a more interesting and dynamic track.

Screencast

{excerpt}
Read More

Applying the core principles of iterative design to make users love you

When to use iterative design

Although iterative design can be incorporated at any phase of the software development life cycle (when the solution has been launched, but you want to seamlessly introduce new features or improvements), multifunctional teams prefer to either iterate or not — to make the whole process more productive and cost-effective.

Indeed, it’s much easier and cheaper to develop a prototype and test it than to build the whole system and fussily start making changes according to user feedback. Moreover, the tech market offers a great number of powerful tools you can make use of to enhance the prototype development.

And if you’ve come up with several variants of key features or early-stage products, iterative design can really help you to choose the right starting position and go ahead with it until invalidated or a pivot is needed.

Iterative design and agile methodology

Iterative design is closely intertwined with Agile software development. Unlike the traditional waterfall model with its stringent development stages, iterative design welcomes new information that may affect the initial requirements.

The process starts with research for user needs or with a hypothesis. Then, the team meets to compile a list of desired features or functionality, known as a product backlog. After the features have been worked through and prioritized, they are implemented within short timeboxed cycles (sprints), with each sprint typically lasting one or two weeks.

Once the first functionality has been released, the development team receives feedback from the product owners and users. This feedback is analyzed during a sprint review and serves as a cornerstone for planning the next increment. In other words, the team proceeds to backlog grooming and prioritizes features for the next sprint, which might include, for example, addressing the bottlenecks found in the customer journey.

However, when the feedback reveals evident bugs that can’t wait a week to be dealt with, the team proceeds to so-called hotfixes.

Getting started with iterative design

Iterative design presupposes the completion of three key stages.

User analysis and design thinking

Like in most software development models, iterative design starts with user analysis. Based on the gathered information, you identify the major problems and goals that will help you define the core functionality of your future product.

For example, if you’re building a live streaming platform, you’ll probably deal with the need for high quality of streaming content, cross-browser and cross-device compatibility, an advanced video player, multiple payment options, and more.

With all this information in mind, you proceed to solution ideation, akin to the third stage of the design thinking model. During this stage, you’re looking into the ways to solve the above-mentioned problems and, in agreement with your client, create customer journey maps, user scenarios, and personas.

During the ideation stage, you can implement one of these design-thinking techniques:

  • Brainstorming represents an oral discussion of various ideas (even wild ones) in the group and blending them to create the optimal one.
  • Brainwriting consists in writing down new ideas on a sheet of paper and passing it on to other team members for tweaking or enhancement.
  • Brainwalking is very similar to brainwriting; the core difference is that it makes the participants get out of their seats and move to other spots of the brainstorming table.
  • Braindumping is individual brainstorming that entails sharing the ideas in the group later on.
  • SCAMPER helps you explore new ideas or review the existing ones by looking at them through seven “provocation lenses”: substitute (S), combine (C), adapt (A), modify (M), put to another use (P), eliminate (E), and reverse (R).

Design and implementation

When the initial planning and analysis are out of the way, it’s time to get down to prototype creation (if it’s a new design) or to expand the already available design.

To continue with a streaming app example, you’ll have to tackle the following challenges:

  • Creating an uncluttered UI
  • Optimizing the system for various browsers, platforms, and operating systems
  • Introducing various subscription models and payment options
  • Building a customizable video player with DVR controls, subtitle management, and multi-language support
  • Implementing a holistic CDN approach so that the system could support a slew of simultaneous users.

Testing and evaluation

When the first shippable functionality is delivered, it’s time to implement a range of testing procedures to identify potential bugs and make the corresponding changes. During this stage, you also get valuable feedback by trying your product on real users.

For instance, with UI and UX testing, you’ll make sure your video streaming app matches the initial mockups and that all users, including those with disabilities, can easily navigate the app — across all resolutions and screen orientations.

Functional testing will help verify that your app behaves the way it’s supposed to. This may include validating the correctness of user data, like purchasing or personal information.

Integration testing will check how your solution interacts with third-party systems, such as payment gateways. Another testing type you’ll likely tap into is load testing aimed at determining a system’s behavior under normal conditions and peak traffic.

After all the needed testing procedures are complete, the evaluation or review phase begins, where you and your client discuss where the project is, what should be changed, etc. This is the heart of iterative design, when you’re brought back to the first stage and repeat the process.

Looking into examples and case studies

The use of Wikipedia is probably one of the most notable examples of iterative design on the web. It creates content that can be changed by any registered user. The introduced amendments are either accepted or rejected by the editors — according to Wikipedia’s policies and guidelines. The idea is to help Wikipedia evolve to become the go-to online encyclopedia.

Although the use of wikis is not a replica of the iterative design of your project where you have more control over changes, it’s a clear illustration of what the incremental process looks like.

As for more specific case studies of iterative design, the Nielsen Norman Group (NN/g) used rapid iterative prototyping to redesign their homepage.

The first stage consisted of re-analyzing the audience they had in the past (thanks to many-stage usability testing) and a number of qualitative surveys to understand customer reactions to the website and the whole brand. The results of this analysis helped NN/g define their major design objectives, like showing more credibility, creating great aesthetic appeal, and keeping clear pathways to primary offerings.

During the second phase of the homepage redesign, the company used Moqups to build multiple high-fidelity visual prototypes. Those mockups passed three rounds of repetitive testing and new users on both desktop and mobile devices.

With each new round, the NN/g’s team was getting relevant user feedback that was categorized into themes like architecture, layout, and visual style. Based on the received feedback, the designers were able to prioritize the features and make the corresponding tweaks on the homepage.

As a result, such an iterative approach allowed NN/g to explore interesting design options without wasting time on early coding. Moreover, the company managed to maximize user feedback and make live enhancements during usability testing.

Enjoying the benefits of iterative design

The NN/g’s case study shows that the cyclic process of designing a product bears its fruit. Iterative design allows you to vastly improve product versioning, increase its quality, as well as easily adapt to changing user and market requirements while succeeding in building truly user-centric products. This model will also help you ensure outstanding usability, leading to a steady client base growth, strong customer loyalty, and ultimately more money in the bank.

On top of that, the incremental approach to design will help secure smooth communication and collaboration between team members, active customer involvement, and better visibility for stakeholders.

Final note

Designers are increasingly opting for the iterative design model because it lets them create and test ideas faster than ever. The concepts approved by users on early stages can continue their way toward a successful market release. And those that fail to gain traction can be rapidly abandoned, minimizing the cost of the project. As a result, by putting user experience at the crux, iterative design helps you magnify chances for the overall success of your solution.

This is a guest post by Yana Yelina. Yana is a technology writer at Oxagile, a custom software development company based in New York. Yana’s articles have been featured on Creative Bloq, UXMatters, UX Planet, and more. Yana is passionate about the untapped potential of technology and explores perks it can bring businesses of every kind. You can reach the author at [email protected] or on Twitter, LinkedIn and Medium.

How to Create a Cool Cut-Out Text Effect in Illustrator

Final product image
What You’ll Be Creating

In the following steps, you will learn how to create a cool cut-out text effect in Adobe Illustrator.

For starters, you will learn how to set up a simple grid. Using a simple rectangle and the Transform effect, you will learn how to create an LGBT pride rainbow background. Moving on, you will learn how to add a simple piece of text, how to expand it, and how to align the resulting letter shapes.

Using basic vector shape-building techniques, you will learn how to create the cut-out effect and how to easily spread your letter shapes. Finally, you’ll learn how to add a subtle shading effect.

For more inspiration on how to adjust or improve your final text effect, you can find plenty of resources at GraphicRiver.

1. How to Create a New Document and Set Up a Grid

Hit Control-N to create a new document. Select Pixels from the Units drop-down menu, enter 850 in the width box and 900 in the height box, and then click that More Settings button. Select RGB for the Color Mode, set the Raster Effects to Screen (72 ppi), and then click Create Document.

Enable the Grid (View > Show Grid) and the Snap to Grid (View > Snap to Grid). You will need a grid every 10 px, so simply go to Edit > Preferences > Guides & Grid, and enter 10 in the Gridline every box and 1 in the Subdivisions box. Try not to get discouraged by all that grid—it will make your work easier, and keep in mind that you can easily enable or disable it using the Control-“ keyboard shortcut.

You can learn more about Illustrator’s grid system in this short tutorial from Andrei Stefan: Understanding Adobe Illustrator’s Grid System.

You should also open the Info panel (Window > Info) for a live preview with the size and position of your shapes. Don’t forget to set the unit of measurement to pixels from Edit > Preferences > Units. All these options will significantly increase your work speed.

set up grid

2. How to Create the LGBT Pride Rainbow Background

Step 1

Pick the Rectangle Tool (M) and focus on your toolbar. Remove the color from the stroke and then select the fill and set its color to R=255 G=0 B=0.

Move to your artboard and simply create an 850 x 150 px shape—the grid and the Snap to Grid should make it easier. Place this new shape as shown below.

rectangle tool

Step 2

Make sure that your rectangle is selected and go to Effect > Distort & Transform > Transform. Drag the Move-Vertical slider to 150 px, enter 5 in the Copies input field, and click OK.

transform effect

Step 3

Make sure that your rectangle is still selected, go to Object > Expand Appearance, and Ungroup (Shift-Control-G) the resulting group of shapes.

expand appearance

Step 4

Select your rectangles one by one and replace the existing fill colors with the ones shown below.

recolor

3. How to Create the Text Effect Frame

Step 1

Pick the Rectangle Tool (M) and create a 380 x 440 px shape. Fill this new shape with white (R=255 G=255 B=255) and place it as shown below.

white rectangle

Step 2

Pick the Path Selection Tool (A) and select your white rectangle. Focus on the Options bar and enter 10 px in the Corners input field.

radius

Step 3

Pick the Rectangle Tool (M) and create a 340 x 400 px shape. Fill this new rectangle with R=255 G=0 B=0, lower its Opacity to around 30%, and place it as shown in the following image.

transparent rectangle

4. How to Create and Align the Text Effect

Step 1

Pick the Type Tool (T) and open the Character panel (Window > Type > Character). Select the Odudo font and set the size to 150 px, the leading to 150 px, and the tracking to 300.

Click on the artboard and add your text about as shown below. Make it black.

type tool

Step 2

Make sure that your text is still selected and go to Type > Create Outlines (Shift-Control-O). Ungroup (Shift-Control-G) the resulting group of shapes.

create outlines

Step 3

Now you need to align your letter shapes to the edges of that transparent red rectangle.

Let’s start with the “L” shape. Select it along with the red rectangle. Click on the edge of the rectangle to highlight it and therefore make it your key object. Open the Align panel (Window > Align) and click the Vertical Align Top and Horizontal Align Right buttons.

Use the same technique along with the other buttons from the Align panel to align your letter shapes as shown in the third image.

align text

Step 4

Select the red rectangle and simply delete it.

delete rectangle

5. How to Stylize the Vector Text Effect

Step 1

Select all your letter shapes along with the white shape, open the Pathfinder panel (Window > Pathfinder), and click the Divide button.

pathfinder divide

Step 2

Select the letter shapes one by one and spread them roughly as shown in the following image.

spread letter shapes

Step 3

Select all the white shapes, turn them into a compound path (Object > Compound Path > Make or Control-8), and bring it to the front (Shift-Control-]).

make compound path

Step 4

Make sure that your white compound path is still selected and go to Effect > Stylize > Drop Shadow. Enter the settings shown in the first window, click OK, and then apply the other two Drop Shadow effects.

drop shadow effect

Congratulations! You’re Done!

Here is how your cool cut-out text effect should look. I hope you’ve enjoyed this tutorial and can apply these techniques in your future projects. Don’t hesitate to share your final result in the comments section.

Feel free to adjust the final design and make it your own. You can find some great sources of inspiration at GraphicRiver, with interesting solutions to improve your design.

final product

{excerpt}
Read More