Tagged with apple

Browse all tags

How to select images using PHPickerViewController with SwiftUI

Jan 9, 2021

Selecting images from our iPhone library is needed when changing a profile picture, posting an update, or sharing the photo of your pet. In this post, we are going to look into how to use `PHPickerViewController` with SwiftUI. Apple announced this view controller at WWDC2020.

Read more

Background Color with SwiftUI

Dec 27, 2020

Once you create a SwiftUI view, it has the default background color. White for light mode and black for dark mode respectively. But how to change it to something different? Let's look into that today.

Read more

How to deal with modal views (a.k.a. sheets) with SwiftUI

Nov 22, 2020

When presenting a small piece of extra information on the screen, showing a modal view is essential. With UIKit, we could do this with `presentViewController:animated:completion:` [function](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621380-presentviewcontroller). However, using SwiftUI, we need to twist our thinking towards using view or environment state, as the modal view is now called a sheet.

Read more

Launch Screen with SwiftUI

Oct 31, 2020

Launch Screen is the first interaction that users see when using our apps. That's why investing time in making our app launch screens feel responsive and visually appealing is important. We are playing with the perceived time and it can be a great first impression.

Read more

Use Custom Font with Dynamic Type in iOS apps

Sep 26, 2020

A while back we looked into dynamic type with the system font. This time we are going to check out how to use the dynamic type with a custom font in our iOS apps. Apple provides great APIs to make our apps accessible even if we're using custom font styles.

Read more

Mapview with SwiftUI

Jul 27, 2020

Finding places, navigating our way, or simply checking what's around - these are essential things that smartphones can help with. This year Apple added maps functionality to the SwiftUI framework. Let's check out how we can use it and what are the current problems.

Read more

Embracing the Dynamic Type

Every year the third Thursday of May is the Global Accessibility Awareness Day. This time I want to focus on Dynamic Type in our iOS, iPadOS, and macOS projects. By implementing font scaling we can improve lives for loads of people with disabilities and impairments.

Read more

Different flavors of WebSockets on Vapor with Swift

Swift on the server lately is getting more traction despite IBM leaving the club. One of the most popular frameworks out there is Vapor. It is built on top of Apple’s SwiftNIO and written fully in Swift programming language. This time we will look into how to work with WebSockets using Vapor framework. We are going to see how to create a client and server using Vapor’s module WebSocketKit and Vapor framework itself.

Read more

NSTimer vs CADisplayLink

`NSTimer` or just `Timer` in Swift world is a commonly used way to execute something repeatedly with an interval. For instance, a countdown timer is a perfect example. A hidden gem is `CADisplayLink` - a special flavor of timer that is linked to the device screen refresh rate. Usually, it is 60 frames per second, but in new iPads, it is 120 frames per second.

Read more

Clearing up after subscribing to Swift WebSockets

Feb 25, 2020

Opening and keeping a WebSocket connection alive isn't enough when dealing with it. The connection needs to be closed either from user or sever side. That is [mentioned](https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-6) in the official WebSocket protocol. Previously we have seen how to implement WebSockets using [Starscream library](/websockets-swift/), [URLSessionWebSocketTask](/websockets-ios-13-swift/) and [GraphQL](https://kristaps.me/graphql-subscriptions/) in Swift projects. This time we will look into cleaning up the connection after you don’t need it anymore.

Read more

Ignorance of the URLRequest cache

Jan 18, 2020

Caching and invalidating cache is one of the hardest things in computer science [according to](https://martinfowler.com/bliki/TwoHardThings.html) Martin Fowler. Recently I was dealing with cache and invalidating it in three of my applications. I had some serious issues with that and wanted to dig deeper. This time we will discuss `URLRequest` caching strategies and how to use it in your apps. I will share some of my learnings and problems that I found.

Read more

GraphQL Advances when fetching data in iOS with Swift and Apollo SDK

Dec 27, 2019

In previous articles, we discussed how to [get started](/graphql-ios-swift/) with and use [subscriptions](/graphql-subscriptions/) with GraphQL in iOS (and iPadOS, tvOS, and macOS) using Swift programming language. This time I want to discuss some advanced topics using GraphQL with Apollo SDK and Swift: usage of GraphQL fragments and Swift scalar types; optionality with GraphQL and it’s pros and cons.

Read more

How to use subscriptions with GraphQL using Apollo iOS SDK and Swift

Nov 26, 2019

GraphQL main functionality is to fetch and update data from the server. In addition to that subscriptions allow us to listen and to send messages from and to server in real-time. It is similar to regular queries, but the answer will be received when an event happens either on the server or on the client. Apollo iOS SDK library supports subscriptions and it is powered by the Swift WebSocket library [Starscream](/websockets-swift/) behind the scenes to connect to the server. Let's look at how to set it up and start using it.

Read more

Dark Side of the App Store

Sep 25, 2019

I am an Apple fanboy and I admit that. But one of the most frustrating things in being an app developer is dealing with the App Store review and compliance teams. This time I would like to share my experience with these problems.

Read more

Using GraphQL in iOS with Swift

Aug 28, 2019

GraphQL is an alternative to the commonly used REST API approach. When using [GraphQL](https://graphql.org/) you only get one single endpoint to the server and through that endpoint you need to specify the exact data you need. It was created by Facebook in 2012 and open-sourced in 2015. Using GraphQL in your Swift applications is not that hard. The easiest way is to use [Apollo iOS](https://github.com/apollographql/apollo-ios) client which recently has seen a lot of great improvements and bug fixes. Apollo iOS is a strongly-typed, caching GraphQL client for iOS, macOS, iPadOS, watchOS, and tvOS. It is written in Swift programming language.

Read more

Websockets in iOS 13 using Swift and Xcode 11

Jul 24, 2019

Websockets in iOS 13, macOS 10.15, tvOS 13, watchOS 6 and Mac Catalyst have gained first-class citizen status in networking stack. Apple has finally added support in [URLSession](https://developer.apple.com/documentation/foundation/urlsessionwebsockettask) and for lower level in [Network.framework](https://developer.apple.com/documentation/network/nwprotocolwebsocket) for their platforms. This time we will focus on implementing Websockets using URLSession capabilities.

Read more

WWDC 2019

Jun 26, 2019

This year I finally had a chance to attend [WWDC](https://developer.apple.com/wwdc19/) (Apple Worldwide Developers Conference). It has always been my dream to go there and see the Keynote, conference and all other events with my own eyes.

Read more