Tag: swift

Week News

Starting January 1, 2021, Apple is reducing their cut from the sales of apps, in the App Store, from the current 30% down to 15% for developers making less than one million dollars per year.

That is a fantastic news for small developers and will help them to grow their businesses

On the following video, you can watch an Apple M1 based MacBook Pro smoke an Intel version of the same computer and specs.

The Apple M1 chip is so optimized for the hardware that we have seen an M1 MacBook pro running Safari with 14 tabs open and playing videos, plus a front tab playing a 4K video and Final Cut Pro editing a 6K video, all at the same time with no effect whatsoever on the CPU load. As the cherry on top of the cake, a benchmark app was run on that Mac and showed just a slightest decrease on the performance.

By the way, the fan never kicked, the computer kept at room temperature the whole time and the whole thing was consuming just 25% of the power it would consume if it was Intel.

With the launch of Apple M1 for desktop/mobile computers, Apple changes the paradigm of how much memory do you really need to do most operations. Using the same amount of memory, Apple M1 computers can do a hell more compared to Intel based computers. This same tight integration and optimization between CPU and hardware can be seen on iPhones and this explains why top notch iPhones with “just” 4GB of memory can obliterate Android phones with 12GB in performance and power consumption.

Apple silicon is so efficient and fast that will make you cry.

 

Code Highlight

1. Go over the ten view limit

All containers in SwiftUI must return no more than ten children. This works for most of the cases but not for all. If you need to bypass this limit, you can group controls using the Group container, like seen in the following code:

2. Control padding precisely

Padding lets you control how much space you need to apply around views. If you need fine control over the amount of padding to apply to each direction, use the following syntax:

3. Use a lazy stack to increase efficienty

HStack and VStack load their contents at once. This may cause slowness and high memory use, specially if you have a list with a lot of items. Instead you can use LazyHStack or LazyHStack, as shown in the following code:

instead of using

Starting this year, the Swift course created by Stanford University, is entirely based on Swift UI, as UIKit is being relegated to legacy technology. The course, as always, has as the spectacular Paul Hegarty, in our opinion one of the best Swift instructors out there, as the main instructor.

The full course, called CS193p, can be found here.

In the following video, you can see the power of synthesis of Swift, where a code like,

can be simplified into,

You cannot miss that course.

 

Sponsorship

All you need to know if you want to sponsorship this newsletter, in the following link.