background preloader

Tutorials

Facebook Twitter

Common Mistakes With Adding Custom Fonts to Your iOS App. Custom fonts can make all the difference in the world when you’re trying to convey a specific user experience. Luckily, it’s pretty easy to add your own fonts in your iOS app but there are some common pitfalls to watch out for. Let’s walk through how to add custom fonts to your iOS application and I’ll highlight the common mistakes as we go. ARTICLE CONTENTS 1. Include your fonts in your XCode project 2. Make sure you have a proper font license for mobile/app embedding. Step 1: Include your fonts in your XCode project Most commonly, you’ll have a TTF or OTF font that you’ll want to use with all of your UILabels or UITextViews in your app. I commonly keep all of my app resources such as images or fonts in their own directory called “Resources”.

Make sure that the target you want to use your font in is checked! Step 2: Make sure that they’re included in the target The next thing to do is to make sure that they’re resources and included in your build target that you want to use the fonts in.

Books

Videos. Games. How to make a horizontal paging UIScrollView with Auto Layout in Storyboards [Swift 3] | Sweettutos. Update August 2016: Fully updated for Xcode 8 and Swift 3 Since Auto Layout came to life, the task of making adaptive user interfaces that support all screen sizes, has become a piece of cake. Although that’s a bit of a challenge in some of the situations, this technology has helped get things done easier and faster than before with more enhanced and optimised UI. In this tutorial, you will learn how to make a cool starting slideshow for your app, something you would show to the user the first time he launches the app, so that you guide him over the main features of your app. These kind of slideshows are famous and are implemented in many apps with different fancy layouts and animations.

Without further ado, let’s slide in Open up Xcode, select “File\New\Project” from the menu, choose the “Single View Application” template and make sure the default language is Swift. Select ‘Main.storyboard’ from the ‘Project navigator’ view, then choose one of the device sizes from the “View as” panel. Swift Guide to Map Filter Reduce. May 9, 2016 · 7 minute read · 1 Comment Swift Using map, filter or reduce to operate on Swift collection types such as Array or Dictionary is something that can take getting used to. Unless you have experience with functional languages your instinct may be to reach for the more familiar for-in loop. With that in mind here is my guide to using map, filter, reduce (and flatMap). Map Use map to loop over a collection and apply the same operation to each element in the collection. The map function returns an array containing the results of applying a mapping or transform function to each item: We could use a for-in loop to compute the squares of each item in an array: let values = [2.0,4.0,5.0,7.0] var squares: [Double] = [] for value in values { squares.append(value*value) } This works but the boilerplate code to declare the type of the squares array and then loop over it is a little verbose.

Let values = [2.0,4.0,5.0,7.0] let squares = values.map {$0 * $0} // [4.0, 16.0, 25.0, 49.0] Filter. OS X Stack Views with NSStackView. We’ve all been there: that moment when you start laying down the UI of your app window and it all looks great. But then you have to make it practical. Once there are more than a few Cocoa controls laying around, you start planning how to put Auto Layout to work so that all your views reposition and resize as desired when the user resizes the app window. The fun starts when you add constraints in Interface Builder — things can get complex very quickly.

Often, you’ll end up with constraints that contradict each other and you need to retrace your steps to find the offending constraint and adjust it to play nicely with the rest. Stack views were introduced with the release of OS X Mavericks, and ever since, they’ve spread to watchOS (well, a similar form at least) and iOS. Note: This NSStackView tutorial assumes basic familiarity with Auto Layout. What is a Stack View? At first glance, it might not look like much, but you’ll be surprised how much power you gain from a simple stack. UISearchController Tutorial: Getting Started. So much data, so little time.

Note: Updated for Xcode 7.3, iOS 9.3, and Swift 2.2 on 04-03-2016 Update note: This tutorial was updated to iOS 9 and Swift 2 by Andy Pereira. Original post by Tutorial Team Member Nicolas Martin. If your app displays large datasets, scrolling through massive lists becomes slow and frustrating. In that case, it’s vitally important to allow users to search for specific items. Lucky for you, UIKit includes UISearchBar which seamlessly integrates with UITableView and allows for quick, responsive filtering of information. In this UISearchController tutorial, you’ll build a searchable Candy app which is based on a standard table view. Ready for some sugar-coated search results? Getting Started Download the starter project from the tutorial here and open the project.

Back in Xcode, the file Candy.swift contains a class to store the information about each piece of candy you’ll be displaying. Populating the Table View Open MasterViewController.swift. Creating a Sidebar Menu in iOS Apps Using Swift. As promised, here is the Swift version of the slide out sidebar menu tutorial. Again we will make use of an open source library called SWRevealViewController to build the sidebar menu. Though the library was written in Objective-C, you can easily integrate it into any Swift project. You will see how easy you can access and interact with Objective-C classes using Swift. Okay, let’s get started.

In this tutorial, I will show you how create a slide-out navigation menu similar to the one you find in the Gmail app. If you’re unfamiliar with slide out navigation menu, take a look at the figure on the right. Slide-out navigation consists of a panel that slides out from underneath the left or the right of the main content area, revealing a vertically independent scroll view that serves as the primary navigation for the application. From what I know, the slide-out sidebar menu was first introduced by Facebook. You can build the sidebar menu from the ground up. A Glance at the Demo App That’s it! UIScrollView Tutorial: Getting Started. If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Learn how to use UIScrollViews for paging, zooming, scrolling, and more! Note from Ray: This is a Swift update to a popular Objective-C tutorial on our site.

Update to Swift, iOS 9 and Xcode 7.1.1 by Corinne Krych; Original post by Tutorial Team member Matt Galloway. Enjoy! UIScrollView is one of the most versatile and useful controls in iOS. How to use a UIScrollView to zoom and view a very large image.How to keep the UIScrollView‘s content centered while zooming.How to use UIScrollView for vertical scrolling with Auto Layout.How to keep text input components visible when the keyboard is displayed.How to use UIPageViewController, in conjunction with UIPageControl, to allow scrolling through multiple pages of content.

This tutorial assumes that you know how to use Interface Builder to add new objects to a view and connect outlets between your code and the Storyboard. Getting Started. Background Modes Tutorial: Getting Started. Learn how to make your app do stuff even when it is no longer active Update note: This tutorial was updated to iOS 8 and Swift by Ray Fix. Original post by Gustavo Ambrozio. Since the ancient days of iOS 4, you can design your apps to stay suspended in memory when users push the home button. Even though the app is in memory, its operations are paused until the user starts it again. Of course there are exceptions to this rule! There are important restrictions on the use of background operations and the specifics have evolved with each release of iOS in an effort to improve user experience and extend battery life. Previous to iOS 7, apps were given up to 10 continuous minutes to finish whatever they were doing before being truly suspended.

So backgrounding may not be for you. As you’ll soon learn, there are several background modes available to you in iOS. Getting Started Before digging into the project, here’s a quick overview of the basic background modes available in iOS. Playing Audio. UISearchController Tutorial: Getting Started. Learn - Modules. Push Notifications Tutorial: Getting Started. If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Learn how to get started with push notifications! iOS developers love to imagine users of their awesome app using the app all day, every day. Unfortunately, the cold hard truth is that users will sometimes have to close the app and perform other activities. Laundry doesn’t fold itself, you know :] Happily, push notifications allow developers to reach users and perform small tasks even when users aren’t actively using an app!

Push notifications have become more and more powerful since they were first introduced. Display a short text message Play a notification sound Set a badge number on the app’s icon Provide actions the user can take without opening the app Be silent, allowing the app to wake up in the background and perform a task This push notifications tutorial will go over how push notifications work, and let you try out their features. An iOS device. Getting Started Build and run. How to Use iOS Charts API to Create Beautiful Charts in Swift. Using charts to display data can help users understand the information more easily than they would if it were presented in a table, especially when dealing with a lot of data. With charts, you can easily see patterns in the data at a glance as opposed to reading through a whole table (or several tables) to get this information.

The use of charts has been a common feature in business and fitness apps. In this article, we’ll look at how to add charts to your application using the ios-charts library by Daniel Cohen Gindi. ios-charts is an iOS port of the fairly popular Android library MPAndroidChart created by Philipp Jahoda. With this library, you can include various types of charts in your app fairly quickly and easily. With a few lines of code, you can have a fully working and interactive chart, that is highly customizable. Core features of the library include: Getting Started To get started, first download the starter project we’ll be using in the tutorial. Creating a Bar Chart Animation. Learn swift in Y Minutes.

Swift is a programming language for iOS and OS X development created by Apple. Designed to coexist with Objective-C and to be more resilient against erroneous code, Swift was introduced in 2014 at Apple’s developer conference WWDC. It is built with the LLVM compiler included in Xcode 6+. The official Swift Programming Language book from Apple is now available via iBooks. See also Apple’s getting started guide, which has a complete tutorial on Swift. Got a suggestion? The Many Faces of Swift Functions · objc.io. Although Objective-C has some strange-looking syntax compared to other programming languages, the method syntax is pretty straightforward once you get the hang of it. Here is a quick throwback: In contrast, while Swift syntax looks a lot more like other programming languages, it can also get a lot more complicated and confusing than Objective-C.

Before I continue, I want to clarify the difference between a Swift method and function, as I’ll be using both terms throughout this article. Here is the definition of methods, according to Apple’s Swift Programming Language Book: Methods are functions that are associated with a particular type. Classes, structures, and enumerations can all define instance methods, which encapsulate specific tasks and functionality for working with an instance of a given type. TL;DR: Functions are standalone, while methods are functions that are encapsulated in a class, struct, or enum.

Anatomy of Swift Functions Let’s start with a simple “Hello, World!” @end. Swift Swift: Implementing Picker Views. [Updated to Swift 2.1 2/5/16 SJL] This week, we’ll look at UIPickerView. Picker views are the spin-wheel like controls that often remind me of slot machines. Picker views, like table and collection views, are delegate based. You need to adopt a delegate and data source to get them to work properly. Picker views also take a lot of screen real estate that is not under developer control, which means your view can get crushed quickly.

These two probably account for its lack of popularity. Most of what can be done in a picker view can be done far better in a table view. Professional developers do not use them as often as table views, but they work well for static multi-selection situations. Start with a new Swift single-view project in Xcode named SwiftPickerViewPizzaDemo. We’ll need outlets for both the picker and the label. The UIPickerView uses an array of arrays to store the titles for the wheels. Xcode will give us an error about required methods we need to implement. Selecting a Row. UIPickerView as inputview for UITextField. Deze tutorial is bijgewerkt voor X-code 7.0 & gierzwaluw 2.0 Dit wordt zeer vaak gebruikt in vele iOS-apps. In plaats van het toetsenbord opduiken wanneer je klikt op het tekstveld, de picker view opduikt. En je kunt een of meerdere strings selecteren die moet worden toegevoegd aan het tekstveld.

Ten eerste laat het opzetten van de x-code project zoals gebruikelijk. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Build and run app in iPhone 5s. Uitdaging: Add bar on top of picker view with buttons & label als volgt. Uber challenge: Show two columns in uipickerview & update textfield from strings of each column Je kan download picker textfield demo X code file hier.

Uitdaging : Add bar on top of picker view with buttons & label als volgt (Wenk: zie mijn close keyboard Zelfstudie hier) Je kan download picker textfield challenge solution X code file hier. Uber Challenge : Show two columns in uipickerview & update textfield from strings of each column (Wenk: zie mijn pickerview Zelfstudie hier) Infinite scrolling. Scroll in two directions, like Netflix. Want to give users a way to casually explore different categories of content without having to tap into a detail page? Independently scrolling rows can help you achieve this effect. Netflix and the App Store use this type of UI for their discovery dashboards. Since the images are in sort of a grid, a Collection View seems like a natural tool of choice. Collection Views do support scrolling in both directions, but its sections are not designed to scroll independently. This is where Table Views come into the picture. This tutorial covers how to leverage a Table View to handle vertical scrolling, while using a Collection View for the horizontal part.

Update: There is now a Part 2 which covers how to make an API call to IMDB and populate the cells with movie images. The Approach The Table View is going to handle vertical scrolling. Set Up the Table View 1. 2. 3. 4. 5. Class ViewController: UIViewController, UITableViewDataSource { } 6. 7. 8. 9. 10. 11. 12. 13. Set Up the Collection View 1. 2. iOS & Swift Tutorial: UITableViewController. A collection of Swift tutorial sites.