fabiochiu/medium-articles huggingface dataset:
NewPath Learnings’ Write-On, Wipe-Off Activities Make Learning Fun!
By: Newpath Learning
Tags: Online Learning

It’s never been this easy and exciting to learn! With activities that build comprehension through hands-on interaction, reusable Write-On, Wipe-Off Activities provide endless hours of learning fun.

Not just that, NewPath Learnings’ Early Learners Write-On, Wipe-Off Activities reinforce fundamental skills with brightly-colored exercises created to make learning feel like a game. And they're reusable, so kids can return to them as often as they want!

Here are a few examples of how these activities make learning more enjoyable for your child.

They Make Learning Fun

The Write-On, Wipe-Off Activities pique children’s interest in learning numbers and letters with their appealing images and text. Traceable rocket ships and soccer balls will be displayed alongside word-tracing exercises, as well as Dalmatians and penguins that will teach your child how to count.

It Is Not Restricted to A Specific Age Group

If your child is having difficulty writing letters or numbers, it can be difficult to find books that will help them practice without having age bands adorned on the covers.

With the Write-On, Wipe-Off Activities, your child will not feel “too old” or “too young” to practice the skill-building exercises inside. They allow kids to practice writing and counting in a stress-free environment, whether they are in preschool or first grade.

They are designed to withstand years of use

There’s no need to replace these resources after just one use because the write-and-wipe format ensures they’ll stay on the shelf for years and can be used by future students as well. Kids can simply wipe to erase all marks made and redo the learning exercises, focusing on the ones that need work!

Write-On, Wipe-Off Activities help build student confidence as they practice essential curriculum skills. Kids love that they can draw all over these books, and teachers and parents love that the Write-On, Wipe-Off format allows kids write over and over again and again.

So, what are you waiting for? Make learning fun this summer by providing your children with activities that they can use for quiet time again and again!

Shop the most popular Write-On, Wipe-Off Activities right here! All Flip Charts and related materials can be found at https://www.newpathlearning.com/
Master Chess Camp Instructor: Grandmaster Alex Stripunsky
By: Matan Prilleltensky
Tags: Online Learning, Summer Camp, Chess, Chess Tournament Training, Chess Lesson

It’s summer. For us, that means three weeks of Master Chess Camp starting in August! I want to talk a little bit about summer camp, Master Chess style.

Last year, we had our first ever camp. We put an amazing team of instructors together, almost all of whom are returning this year. It was a huge amount of work, but also a blast. There is something special about working with highly motivated teachers at the top of their game.

We break our students into three groups, based on US Chess rating: 0–1000, 1000–1500, and 1500+. I get excited every time I think about our teachers: Each coach is an absolutely top instructor for their level.

Grandmaster Alex Stripunsky will be coaching students rated 1500+. He is universally considered one of the top coaches in the United States. Alex has worked with talented young players through the International Master level, but he also has a wealth of instructive material geared towards aspiring experts and masters. Alex is also my coach!

My chess development was mostly ‘freestyle’, without a regular coach, or systematic training, so I had lots of basic knowledge gaps, even as an adult 2150–2200 player and school teacher. A couple highlights from my first lessons with Alex:

Alex: Matan, what are you meant to do when you have two bishops?

Matan: Open the position.

Alex: No. Attack on the color of your unopposed bishop. Fight against your opponent’s remaining bishop.

I swear, I gained 50 rating points just by following this advice. Somehow I kept on giving checkmate on g2 when I had an unopposed light squared bishop!

Another Alex special: “Matan. I noticed that sometimes you do not develop your pieces.” I was so insulted! How dare he. Then he showed me some of my games, where I was moving my pieces around in pursuit of some ill-defined goal, rather than bringing them all into play. Touche. It’s funny how knowing something and applying it can be different. . .

One more: “Matan, what is the point of occupying an open file?”

I can’t remember my answer, only that it was not the correct one: “Go to the 7th rank.” Right after this lesson I played a game where I quickly developed my pieces, occupied the c-file, went to the opponent’s 2nd rank, and won with a mating attack!

It’s amazing how valuable it is to learn fundamentals properly from a professional coach.

I have passed many students on to Alex when they outgrow their first teacher, and it is always a pleasure to see them continue to progress. I am never surprised when I see his students rising quickly through the ranks, becoming transformed as players. I am very excited to give our students the opportunity to train with this world-class coach!

Tomorrow, I’ll tell you all about the amazing Elizabeth Spiegel, my first mentor as a chess teacher.
The Ant [Seasons].
By: Precious Moment
Tags: Seasons, Youth, Christ, Precious Moments, Foundation

The Ant [Seasons].

Christ for Youth International

Go to the ant, sluggard; consider her ways and be wise, 7 Who having no guide, overseer, or ruler, 8 Provides her food in the summer and gathers her food in the harvest. [Proverbs 6:6–8AFV]

How strange it must be for the Bible to tell us to go and learn from an ant. These tiny and actually quite amazing creatures perform feats that one would think only humans should be able to do.

These verses explain to us that the little ant knows the importance of times and seasons. It does not need a leader; it gathers food in the summer so that in the winter it would not perish. Such great wisdom from something of so little regard!

On the side of human beings, however, the story seems to be different. It is only a handful of people who use their time wisely, engaged in acts of service to God or practices that will make them better people. Procrastination and laziness moves freely among many us and it goes against what we are supposed to be as Children of God.

Proverbs 6:10–11 continues to tell us that allowing laziness to take the lead role in our lives, will send us into poverty.

We must in all humility, learn from the ant, learn to value times and seasons and do things that are beneficial to us when we are able. Life is unpredictable and though we have Jesus on our side we must also apply wisdom to our situations. Times are coming where we will be unable to do what we can do now so let us not waste the chance.

Read that book, actualize those plans and apologize to that person you need to. Do what you have told God you will do and you will see that time will become an ally, not an enemy.

Dear Father, please help me make wise and purposeful use of my time.

Further Reading: Proverbs 30:25, 1 Timothy 6:19

Bible In One Year: Genesis [1 — 4]
COTI NFT Game: Summer 2nd Midseason Raffle Results!
Tags: Nft, Seasons, Rewards, Blockchain, Cryptocurrency

We are happy to announce that our second Midseason raffle has selected 2 lucky winners, winning 5,000 $COTI each!

Winner 1:

ETH: 0xb5f45c6bD147b3eaBEf8350c7e418ab1111355B1

COTI:6262ae3d5c09e3050e32d50fac2d7ec775e73f86ffed79ef3cf35a40465bc034c5e6a1b6dba929f08083a329055645af8d23ba35c10c404a2e12d32bfee7558c947e97ba

Winner 2:

ETH: 0x7041bB74553fD011268Da863496dA3CBE4Ab8787

COTI:285342cc7c328b46e88ff35c43277be1d476d2c2457a60139c20763a206321184b4568343960e9d4c9c7ffc985c629cd247e6a277a901a92038a4f6a2b11fd2f60f78bae

The snapshot was taken on Wednesday, August 25th, 2021, at 05:33:54 AM (UTC).

Congratulations to the winners!

As the Summer 4-week season has come to an end, our Seasonal raffle will be held next week — September 2nd, 2021.

We remind you that in order to participate in the seasonal raffle and have a chance at winning 52,000 COTI (1,000 COTI every week, for a full year), you have to hold all 3 Viper NFTs (1 Rare + 1 Unique + 1 Epic).

You can join our designated Telegram Group, where you can discuss and trade with each other.

Want to join the game for the chance to win up to 2,000,000 $COTI? Check out our Game Guide for further information.

Stay COTI!
On: Fallingwater
By: Matthew Pon
Tags: Poetry, Seasons, Fallingwater, Architecture, Nature

On: Fallingwater

For as long as I can remember, my father always talked about this home as one of his greatest inspirations as an architect. Hidden away in an autumnal forest, I was finally able to experience the place for myself. Part of a week-long series to close out 2019

Nestled in the trees, a geometric protrusion of ochre concrete hung: suspended, over a gentle stream. Pools of shimmer danced on the underside from sunlight reflected below by slow rolling water; gentle gusts threw leaves like Autumn shards of painted glass into the rays of sun piercing overhead. Juxtaposed; Fallingwater felt both eerily out of place and yet entirely embedded in the natural shapes of the landscape; the cantilevered shelves of the home almost like clean cut flagstones at the edge of a cliff face.

For years, I dismissed the rapture my father expressed about this place, nestled in the woods about an hour outside of Pittsburgh. Because to us, Frank Lloyd Wright was a joke; an old-man-architect loved by our old-man-architect; irrelevant in the naive worldview of a child surrounded by computers and a concrete jungle. And just as children often rebuke the passions of their parents in staged rebellion, we too dismissed this house as “just some weird thing dad was obsessed about.”

And yet, there were so many moments; walking the halls of this home; that I found myself lost in.
Ways To Keep Cool in the Summer
By: Shaurya Sharma
Tags: Summer Hacks, Seasons, How To Keep Cool, Summer

Keeping cool when temperatures reach record highs isn’t just about comfort. Dangerously high temperatures can result in heat-related illnesses ranging from heat cramps to heat exhaustion and heat stroke. No AC, no problem. There are plenty of ways to stay cool with just a bit of ice, a fan, and some of these tips.

Sleep under a damp towel or sheet. This will feel especially nice if you have a fan running at the same time. The evaporation of the cloth’s water will keep you cool all night, and the sheet or towel will most likely be dry by morning.

Put a bowl of ice in front of your fan. This easy trick is the very best of the DIY air conditioners: just toss a bunch of ice cubes into a metal bowl (or freeze some water straight into the bowl), and set it in front of a running fan. Tilt your fan or the bowl in such a way as to get air flowing directly onto the icy surface, cooling down the blowing air. You’ll feel the effect immediately.

Combat dehydration by drinking plenty of water along with sports drinks or other sources of electrolytes. Instead of hot foods, try lighter summer fare including frequent small meals or snacks containing cold fruit or low fat dairy products. As an added benefit, you won’t have to cook next to a hot stove.

If you don’t have air-conditioning, arrange to spend at least parts of the day in a shopping mall, public library, movie theater, or other public space that is cool. Many cities have cooling centers that are open to the public on sweltering days.

If the heat is intolerable, stay indoors when you can and avoid activities in direct sunlight or on hot asphalt surfaces. Pay special attention to the elderly, infants, and anyone with a chronic illness, as they may dehydrate easily and be more susceptible to heat-related illnesses. Don’t forget that pets also need protection from dehydration and heat-related illnesses too.
God Made Everything Beautiful In Its Time
By: Zelle Cuevas-Canuel
Tags: Seasons, Encouragement, Flower In A Pot, Waiting, Bloom

When I receive this flower-in-a-pot, only one bud bloomed. The merchant said this plant would only last for a month. More than a year later, it blossomed so beautifully. I often use flowers as metaphors. So if you are reading this, there are a few things I want to tell you:

Just because it didn’t work the first time, doesn’t mean it’s a failure. Sometimes the right season hasn’t come yet. Be patient.

If people tell you that you will not make it, remember that even experts can be wrong at times. Don’t let others define you.

God made everything beautiful in its time (Ecclesiastes 3:11). Don’t be pressured by the breakthroughs of others. Focus on your own journey and growth while you delight yourself in the Lord. You’ll see how beautiful your story can become.

Flowers don’t compare themselves with other flowers around them. They just bloom. You are most beautiful when you are being yourself. Stop comparing yourself with others. Celebrate who you are because you are fearfully and wonderfully made.

A lot of times you need space to grow. Don’t be afraid to get out of your comfort zone. It may be uncomfortable at first, but you’ll eventually see how it will expand your knowledge, experience, territory, and influence.

Things may not happen according to your own timeline. But trust the One who holds time. He knows when to unfold your story.
UnRequited Love made my life better.
Tags: Lost Love, Friendship, Seasons, Growth

Photo by Ava Sol on Unsplash

Just checked my messages for a text from this one person. At this point anything will do, as long as it came from him.

Nothing.

Nothing at all.

I can feel my heart sink. I want to shed a few tears but I promised myself I would not cry over anything that made me feel shitty about myself.

Any day I would have chosen to wait. Wait for him to reach out, but not today. I want to be set free from this roller coaster of being starved of attention, of care. I want to feel alive again.

All this time I have been trying to block everything we ever did together hoping that we still had a chance to make more memories.

The late night conversations. Our hearts bare to each other. we told each other of our secret hopes and longings. I miss this days. These were the days I could fearlessly create the life I imagined and you were there to tell me it wasn’t impossible. And when we talked about our deepest fears, You gave me the courage to rise above them. Now that we no longer talk, I would want you to know that I am grateful that you believed in me at least once.

I miss being goofy with you. I miss your laugh. I miss the times we would spare a little something of everything we ate. I think it was so sweet and cheesy. The days were tough and uncertain but you gave me a reason to smile. Maybe my heart is breaking a little because we outgrew this season.

You were always the more mature one of us two. You still held your calm even when you were so worked up by something. Recently my boss told me I handle pressure so well. At least I learnt that from you.

Doubt kicked in when I started learning things about you from other people. You asked me to trust you and I did. The first time we stayed silent to each other for a month, I could tell something changed, But then you came back and things went on like nothing had happened.

I heard there was someone in your life. One that you never mentioned. I waited for you to come clean but I guess I was waiting for pigs to fly. When you told me the other night that you would always be there for me. what I heard was goodbye. That was a blow. I played dumb to just be sure about what you meant.

We haven’t been the best at communicating our expectations about each other, Mixed signals, attention hidden in I really don’t care what you do but I care if you want me to care. The assumption we will always be friends because we can. All this was exhausting, I needed to know your stand. I needed to know if we were breaking or coming alive. I guess I did. You want something different. That has nothing to do with me. It has everything to do with you and what you want.

I respect that. I respect your decision. I’m content with the fact that at least for once in my life I had a friend who helped me be a better version of me. That’s what it is all about, Growth. I had a person who pushed me to be a better version of me when I needed it. I will be forever grateful to God for the gift that was you.

Maybe we will be friends again but until then Adios Mi Amigo.
Performing A Self Assessment
By: Daniel Rose
Tags: Self Improvement, Seasons, Games, Inspiration, Game Development

It can be difficult to look at our own work critically. Sometimes, it can be painful. It’s an important step for growth as an artist, business person, or athlete. I’ve performed a few self assessments over the years and they are often triggered by a handful of catalysts:

· Job Change, either though a layoff or a project wrapping

· Failure of a personal project to move beyond some sort of sticking point

· Release of a new game that sets a new visual bar

· Release of a new tool that sets a new visual bar

· Release of a new tool or tools that changes the way one works

It’s key to not let these catalysts sneak up on us too much. It’s hard to do that; layoffs happens all the time and it’s impossible to know if we’re in line for one, crunch or busy lives make it hard to play modern games, and news moves so fast that we may miss out on new announcements all together.

Life, they say…finds a way…to get in the way of continual improvement. The key is to not panic.

Now that we’ve realized our need to evaluate our skills, it’s time to determine what we need to focus on. This step can either be extremely tricky, or very straight forward, depending on the landscape we’re operating in.

Trailer for Kenna: Bridge of Spirits. Looks amazingly beautiful and inspires me to explore new styles of work.

First, look to the major catalyst for our decisions to self-assess. Was it a new blockbuster release that blew us away? Why did it gab our attention? What about its’ art, gameplay, or user experience shook you? Perhaps it was a new tool release. Unreal Engine 5 and its’ focus on Nanite took me for a ride and made me realize that my sculpting work can’t just be passable anymore. Perhaps it did the same for you. Maybe it’s the desire to try different kinds of work too, like combat design or a new visual look for our art. Whatever the case is, drill into that big, initial kick to find where that desire is being birthed from.
Writing a Generic/Reusable Networking Layer using Combine Swift iOS
By: Uday P
Tags: Combine, Development, iOS, Swift Programming

Apple launched Combine in 2019 with iOS 13 and it changed the way we do asynchronous programming on iOS platform. There have been some reactive frameworks like RxSwift which people have been using, however, having something native takes away the overhead of adding an additional framework / dependency to your project.

Diving right into it.

Here we’re gonna start with a protocol containing a generic function to handle our requests.

The request function here takes in a custom request — which we’re going to talk about in a while — and returns the Publisher with the respective decoded response and error.

Now let’s add the implementation for that function:

Here is the NetworkRequest class that we use to compose our request:

Now let’s see how we can actually use this to make a request.

Before we do that — I’m going to show you how I organize my API endpoints in an enum.

Here is the Environment:

Now let’s start with creating a service which will have all our requests. This is how one service looks:

Now we can use this service from a manager or from our controller.

I’ll be talking more in future blogs about how to test these publishers and focus more on the testability aspect of this in an upcoming tutorial. Stay Tuned!
How to become an expert in iOS development
By: Yura Istomin
Tags: Programming, iOS App Development, Swift Programming, iOS, Swift

As you continue to read this article, I suppose you have these two traits. So let’s take a look at skills that are necessary for a proper iOS developer.

Computer Science, iOS Platform, Product Thinking

These are three areas in which you should always master your skills.

Computer Science

Do you want to create effective and optimized programs that will work smoothly on all devices? Then you need to know how these devices work under the hood. I don’t say you should know how to build an iPhone from scratch, but it would be useful to know what CPU, memory, and operating system are, and also how they work with software.

Knowledge of the basics of programming also would be helpful. Learn what are variables, functions, operations and data types. Then learn algorithms and data structures.

When you know how to write simple programs, learn Swift deeper. Explore structures and classes, properties and methods, initialization, inheritance, extensions, protocols, generics, memory management, and so on. You should master your main tool!

And don’t forget to practice. Practice as much as you can!

What to Learn in CS

iOS Platform

When you know the basics of computer science and have a great knowledge of Swift, you can begin to study iOS SDK, frameworks and tools. Always try to apply your knowledge in practice. Create applications, scripts, pet projects. Dive deeper into the frameworks and libraries you explore. Knowing algorithms, data structures, language, and hardware a little you can understand the internals of these tools easier.

What to Learn in iOS

Design and Product Thinking

The last area is essential for developers to create not just apps, but great products. The following skills are necessary to build applications for a large audience and to work in teams that create world-class products. Knowing these things you will be able to build your own business or grow yourself as an experienced software developer in another company. But even if you work in a small team or on your pet project, these skills will help you to make better things.

What to Learn in Design and Product Thinking

Conclusion

I’ve prepared a full checklist of the skills on GitHub. You can get in from this repository. Most likely I’m going to maintain this repository adding new subjects. Also, I’d like to cover all of the topics with external links where you could learn about each one.

Probably, you could also contribute to this work. If you know useful recourses covering any subject, leave a link in the comments below, or open a pull request to the GitHub repository.

Also, I’m open to any suggestions. So, if you think I should add somethings to the list, let me know.

Join our Apple Dev Talks chat in Telegram!
Property Wrappers in Swift 5.1
By: Petro Korienev
Tags: Throttling, Swift, Swift Programming, iOS, Mixin

Part 1 — Example

One of the most common test project assignments for rookie iOS developers is implementing single-view app, that allows user to perform github search. Additionally, it is asked to implement search-as-you-type functionality. Let’s go for quick naive implementation of this (full project of first step is referenced here, I’m skipping GithubAPI , GithubResponseCell implementations for brevity):

While this solution satisfies initial requirements, even quick test shows major flaw. If we type “redux” two times in a search field, we’re getting an error display:

Search error

The reason is pretty obvious — Github servers have filters, that disallow single client to issue a lot of requests. This technique is called “rate limiting” and it’s described in Github search API. For instance, repo search request have rate limited by 10 searches per minute (https://developer.github.com/v3/search/#rate-limit). Our ViewController is implemented in a way, that each textDidChange calls GithubAPI and runs an expensive search request.

Doh… how to solve this?

Well, the first idea is that we should mirror somehow the same technique Github’s using in our app. This process is called “Throttling” of requests and it’s feasibility is based on following assumption:
Writing Testable Views in SwiftUI
By: Michael Long
Tags: Programming, Swift Programming, Swiftui, iOS, Swift

Writing Testable Views in SwiftUI

Photo by Jungwoo Hong on Unsplash

In View Composition In SwiftUI, I discussed how SwiftUI encourages us to break our application down into small, easily digestible components and views.

But we can do more.

We can — at the same time and for very little extra work — create components that are easy to test and validate.

An example

Consider the following segment of a screen from an order-taking application that displays a list of the items ordered:

In SwiftUI we could generate a version of the list using the following code:

struct OrderDetailsView: View {

var order: Order

var body: some View {

Form {

ForEach(order.items) { item in

HStack {

if item.quantity == 1 {

Text(item.name)

} else {

Text("\(item.name) $(\(item.quantity, specifier: "%.2f") @ $\(item.price, specifier: "%.2f")")

}

Spacer()

Text("$(\(item.total, specifier: "%.2f")")

}

}

}

}

}

That’s all well and good — but we’re embedding quite a lot of logic in our loop. We’re checking quantities to control how our lines appear and we’re also doing quite a bit of inline formatting (and doing it incorrectly, I might add.)

So, how can we do it better? How do I make sure my code is correct?

Decomposition

Well, one way to do it is to simplify the list code.

Form {

ForEach(order.items) { item in

OrderDetailsRowView(item: item)

}

}

Now the list is brain-dead simple. It loops through out items and hands each item in the list to a view designed specifically to deal with each row.

As long as OrderDetailsRowView works correctly, this code pretty much can’t go wrong.
Swift generics and how to use this feature
By: Ashutos Sahoo
Tags: iOS App Development, Ios Swift, Swift Programming, Generics

Let’s start one of the most powerful feature of swift language.

As per Apple Docs: Generics is one of the most powerful feature in swift, which can be use to write most flexible and reusable codes or functions and types that can be work with any similar type of data.We can write code to avoid duplicate code with a very clear and abstracted manner.

let’s talk little bit more about it and understand what is this and how to use it in our day-to-day coding practice.When it comes to generics many new developers things its a new topic and have to learn about it will take bit time.Let me tell you its nothing like that.I can tell you from the starting of swift coding we are using generics unknowingly. Most of the swift libraries and even we frequently used Array and dictionary also a part of swift generics.

Let’s see how it works.Lets start with an example of it and try to understand it

Example: let declare two array one of type Int and another of type Double

let integerArray = [9,6,7,5,4,3,8] let doubleArray = [9.0,2.0,5.0,4.4,3.5,8.5]

Let’s get the data from the array and print

func to print elements for Array of integers

I have written two patterns to retrieve elements from the array i.e using for loop and using map.Similarly for array of Double we can archive like below-

func to print elements for Array of Doubles

Now we will think where is the issue to get elements on the above two array. To get the elements of those array, we have to write two individual func to get the same operation. Let’s think we have to retrieve elements from similarly for 4 types of data Array like Int, Double, String or any other type.

Here we can go for generics approach. Let’s create our first generic func and print the elements of the above array.

generic func to get the element from a collection of data.

The “T” above function can be replaced by any Alphabet or whatEver we want.The “T” is a placeholder type.Many scenarios “T” don't have a name.For Dict we called it as key value i.e,Dictionary<Key, Value>.For Array we called it as Element i.e , Array<Element>.

Let’s go for multiple parameters:

Example:

Let’s create a func which will take multiple parameter as generic type.This function will take multiple values and compare the value and return us the greater number among them.

func with multi parameters

Conclusion:- Generics are very handy to use in many cases to reduce our code and make them clean.

This is my first blog to give some basic idea about generics , hope you like it.Any suggestions are always welcome.

Here are some of the useful links about Generics:

Here are the some of the links to find me for any question or suggestions:

LinkedIn- https://www.linkedin.com/in/ashutos-sahoo-562a71100/

Twitter -https://twitter.com/sahoo_ashutos
Builder Design Pattern with a Swift Real-World Example
By: Seyit Kaya
Tags: Programming, Swift Programming, Software Development, Swiftui, Swift

Photo by José Pinto on Unsplash

When you google the “Builder Pattern” you can find many old school materials and your mind can be more confused so I want to give you a real-world example and explain with real codes from one of my projects to get little practice.

First thing first let`s have a look at this analogy before writing a piece of code. If we understand the concept without any gap writing code is will be fun and less prone to be the error.

Let`s think about you are a producer of a TV channel who brings together all staff of a program and shows to go alive.

You need to produce a sports show, What do you need for making a basic sport show? Maybe we can make with these as below.

X type Camera

Excited Moderator

Sport Commenter

Colourful Table

What about making news? Probably it will need the same material but with a different type.

Y type Camera

PokerFace Moderator

Political Commenter

Grey color table ( seems more serious right ? )

Okay, you got these materials and you sit down in your working area and step by step you made your tv program news or sports etc.

No one doesn`t bother about you how did you make this all things.

You are a cool producer, you are only reporting to your boss ( app ) and watcher ( client ). If you want to decide to change the commenter or colour of the table, it will be news again but it will be different news with a different concept or a changing table will be so on.

The builder pattern makes similar things in this analogy. Builder is a creational design pattern that lets you construct complex objects( sports program, news ). You can use this creational design pattern with construction codes. Whenever you want to change the content of the construction codes you will be constructing a structure again but in a different style.

Please keep in mind this analogy for a while. I guess you got the idea and let’s turn back to Swift world.
Saving Images in CoreData
By: Sridharan T
Tags: Swift Programming, Uiimage, iOS, Core Data, Swift

Is it possible to store UIImage in core data?

Yes, we can store the images with the core data but not directly as UIImage. This can be achieved by converting UIImage to Data. Because UIImage is not a valid attribute type in Core Data.

If you are new to the core data and want to learn from the basics then refer to this post. Hereby gonna discuss only saving images into core data.

The attribute type used to store image in the core data is Binary Data. So declare the attribute type as Binary Data in your model.

To convert an image into a portable data format like png or jpeg, use the below code:

2. Save the image in core data

3. To fetch the saved image from the core data, use the following code

4. Convert the imageData to UIImage to display it to the user

I am sure that every one of you might have achieved this process successfully. But few may fail, the reason is they will be storing an array of images in the core data.

So you may ask me, is it possible to store my array of images in the core data?. I would say yes, definitely you can and the steps to be followed for that also will be the same as the above one. OOPS!! not exactly the same one, few more secrets to be added to make it work.

For Example, consider this array of images

let myImages = [“car”, “pen”, “camera”, “bag”]

To store this array of images to core data, first convert each image into data and store it in an array.

2. Save array of images to core data

3. Fetch array of images from core data

4. Convert the array of imageData to UIImage as

NSKeyedArchiver is a class that serializes (converts) data very similar to JSONEncoder. NSKeyedUnArchiver is a class that de-serializes (re-converts) data back, very similar to JSONDecoder.

These two play a major role in storing an array of any type of data in the core data.

Tips: There is a way to see your stored images, just use the below code in your console.

po NSSearchPathForDirectoriesInDomains(. documentDirectory , .userDomainMask, true)

This will lead you to the destination of the SQLite file of your core data model. Using the tool DBBrowser for Sqlite you can see your stored images and other data. The tool which I mentioned is an example, there are huge number of tools available in the internet. You can use which you feel comfortable.

It’s interesting right, try this out guys and reach me on Twitter for any doubts and suggestions.
Developing iOS Application Features as Modules in Xcode
By: Nabin Shrestha
Tags: Cocoapods, Programming, Xcode, Swift Programming, Swift

Modules

Segregating the features in our application is very fruitful for maintaining the application as our application keeps on growing. It helps us in rapid development of new features.

Note: We are going to be using cocoapods for creating modules.

Create a new project or open your existing project in Xcode. Open Terminal in root directory of your project. Type “pod init” in terminal and hit Enter. Now let’s add Login Module in our application. Create a directory named “Modules” and execute “cd Modules” in terminal. Now being in Modules directory execute “pod lib create Login” in terminal. We’ll be asked with number of questions to proceed.

6. Xcode will automatically open the Login Project. Don’t close the project. We are going to do some changes to this project.

Delete Tests Group from Project Navigator and Login_Tests Target.

Delete Tests Group

Delete Login_Tests Target

Change Swift Language Version. Login_Example Target > Build Settings > Swift Language Version.

Update Swift Language Version

Build the Project. We’ll get an error in AppDelegate.swift. Fix the error.

Fixing error in AppDelegate.swift

7. Go to Login Project from Finder. Make the hidden files visible if not. The shortcut for this is Command + Shift + .

8. Delete these directory and files.

_Pods.xcodeproj

.git

.gitignore

.travis.yml

The folder structure after looks like below:

8. Go inside Example directory and delete others except:

9. Now go back and open Podfile of your main project. Edit the Podfile to add Login Module.

10. Perform pod install then open ModularProject.xcworkspace. Open your project navigator it should look like this. Build the project.

Here we can see that we’ve new Login-Example scheme that we can run. We can now individually run these schemes when working on specific module/feature. We won’t have to compile the whole main project.

11. Now if you check on the project navigator inside Pods > Development Pods you’ll see something like:

There is a ReplaceMe.swift file there. You can now create a LoginViewController.swift file right clicking on Login Group or rename the ReplaceMe.swift.

12. Now from our main project in ViewController.swift we are going to open LoginViewController.swift that we created in Login Module. I’ve created a Login Button and linked its outlet in ViewController.swift which we’ll use to open LoginViewController.swift. The ViewController.swift class will look like below:

We’ve imported Login Module and added code to push LoginViewController on login button tap.

The LoginViewController.swift inside the Login Module should be public class otherwise we won’t be able to access the class outside the module.

13. We can also create a Core Module that every other module uses where we can add common classes, views, extensions, assets etc. For that we have to add that Core module name in .podspec file that every module has.

14. That’s it. We’ve successfully added features as modules in our project.
Swift | Multi cases Enum handling
By: Pravin Tate
Tags: iOS App Development, Swift Programming, Enum, iOS, Swift

So, let’s see what is issue with multiple cases inside Enum.

Mostly, we are using Switch block for identify enum types and switch is treated as normal if_else block means how many cases we write inside switch all those we can consider as if _ else. So let's consider we have our custom color/ font or other Enum with have more than 15–20 cases. (In application there are many cases where we declare more than 15 cases inside Enum). If we handle all those 20 cases in switch block and if you using SwiftLint then mostly you will following warnings.

function body length

cyclomatic complexity

For example we take colors, where we declared all our standard colors inside single Enum as below:

Here, we have standard four colors with 5 types (extraLight, light, standard, dark and extraDark) and getColor func will return UIColor as per type.

For get color from this Enum, we write function inside UIColor extension as below:

We used it as below:

So, there are 3 ways for get color from this enum. using static func, enum type called getColor or set rawValue for cases and get Color.

So in above code swiftLint should give warnings as cyclomatic_complexity and function_body_length. So how we solve this issue using Enum only. I know some developers use direct static variables for colors inside UIColors but take this as example of multiple cases Enum.

When ever we tried to get color from it using getColor function that time inside switch will call and max iteration count will number of cases. Here we can avoid it using rawValue but again in that one issue as if we need some other things from Enum then we can’t declare multiple rawValue so in that case we need to write func inside enum.
Swift - Write Cleaner Code Using Result Type
By: Mohd Hafiz
Tags: iOS, Swift Programming, Programming, Swift

Swift - Write Cleaner Code Using Result Type

Error handling can even be more simple and easy to implement Mohd Hafiz Follow Jun 10 · 2 min read

Result Type was introduced as an improvement for error handling in Swift 5. It has been widely implemented by iOS developers. Since it was released, all third-party libraries also started to adopt it. But I notice that some developers are still using the old implementation probably because they already get used to it for a long time.

In this article, we are going to discuss and revise the basic usage of Result Type in the basic function and completion method. Let’s see the implementation without and with Result Type.

Without Using Result

First, we will take an example of a simple method to calculate a division of two numbers. As we know the rule of division in maths, the divisor cannot be 0, otherwise the answer will be undefined.

So, we will add a validation for checking the divisor number using guard and return nil if it is failed.

What’s the Issue?

The divide() method above looks fine until we called it and error happens. Now we found the issue and understand that we cannot simply return the details error.

Possible Solutions

Yes, now we would think to modify the method. There are few options that we can try. First, maybe we can use a completion method that returns multiple values such as answer and error message. Or maybe we can use struct or tuple type to combine the answer and the error.

Well, that exactly what Result Type does, though it is more generic and easier to implement.

Solution by Using Result

It is basically same method, except the return type is using Result .

Now we can see that the new divide() method is more readable and simple with proper error handling.

Using Result in Asynchronous Method

As we already known, the asynchronous method need a completion handler to return result or value to the method caller.

Common API request method basically will have the following steps.

Check URL validation Request URL using URLSession Then inside the dataTask completion, we will handle the error and success data Decode data in try block

Let’s take a look at our code below with the Result implementation. It doesn’t look much different, except in the completion return values.

Below is how we call the method and handle the error occurs.
How to Create Infinite Scroll in UITableView
By: Mohd Hafiz
Tags: iOS, Swift Programming, Programming, Swift

Coding Begins

1. Create New UIKit Project

In this project, we will use UIKit and Storyboard.

2. Insert Navigation Controller (Optional)

After creating the project, embed the default ViewController with Navigation View Controller. Select Main.storyboard, then select the top menu Editor > Embed in > Navigation Controller.

3. Insert UITableView to Storyboard

Open the storyboard and insert UITableView. Then pin the constraint to the edges of superview. Don’t forget to link the UITableView as an IBOutlet in ViewController class.

4. Create User Model

Create a new model file called User.swift and add this code. We only get the id, name, and avatarUrl from the JSON object. In this project, we will only display the name as for a quick example.

5. Create API Service Manager

/users endpoint details from GitHub API docs

Create a new file called “GithubAPIManager.swift” to handle API requests. It is just a common API request using URLSession with dataTask() method. In that file, insert the below code.

Create an error type to be used in the completion handler Construct proper API URL with parameters Create URLRequest with a timeout of 10 seconds.

5. Setup TableView and API Integration

Open your ViewController file and add the below code. Also at the bottom of code, we add some of the TableView datasource methods (delegate methods will be used in the next step).

Add users variable to store data from API and whenever it is set, TableView will immediately reload its content. setupView() , a simple setup on TableView. We need to add .delegate later. A function to call our API service and handle data received. Add a default TableView Cell to display the name and row number.

After adding the code, run your project and you should get the simple TableView list as shown in the below image. You will get exactly 30 rows in the TableView as the default perPage parameter and not yet able to paginate.

Simple TableView list with static data of 30 users

6. Setup Pagination

Great. We are done setting up the base of the project. Now, we need to make some updates to make sure our user list can be scrolled endlessly. Update our ViewController class as follows and see the explanation of each code change.

The following is the explanation of the amendments.
iOS 14.5 Data Usage and User Tracking — In-Depth Understanding
By: Santosh Botre
Tags: iOS App Development, Swift Programming, Apple, App Store, iOS

Update: (27 April 2021) “Don’t offer incentives for granting the request,” writes Apple, with developers unable to “offer people compensation for granting their permission.” Developers also cannot “withhold functionality or content or make your app unusable until people allow you to track them.”

In the past few months, there has been a lot of talk and controversy around Apple’s new Tracking Transparency API.

January 27, 2021 is Data Privacy Day @ Apple.

Apple talked about giving more control over their data.

Privacy is always the top priority in the Apple ecosystem. Last year, as part of iOS 14, Apple launched many important privacy features to give more informed decisions about their data.

Apple has release a new guidelines to the Application Developers to provide information about the data application is collecting needs to be declared on the AppStore page. And starting versions of iOS 14.5, iPadOS 14.5, and tvOS 14.5, app’s will be required to ask users for their permission to track them across apps and websites owned by other companies.
Property Wrapper in swift
By: Suryakant Sharma
Tags: iOS App Development, Swift Programming, Propertywrapper, iOS, Swift

Let’s understand why they exist. How we can leverage their use for code reusability and better readability.

Why we need ?

When dealing with properties we need to associate same logic when property’s value get initialize and change. For example validate values according to set of rule or changing it before assigning. One way is to use property observer (willSet/DidSet). But it seems repeated for every property not adhere to DRY. Is there is better way ? Yes That what property wrappers comes in existence. Here is what official documentation says about this.

A property wrapper adds a layer of separation between code that manages how a property is stored and the code that defines a property. For example, if you have properties that provide thread-safety checks or store their underlying data in a database, you have to write that code on every property. When you use a property wrapper, you write the management code once when you define the wrapper, and then reuse that management code by applying it to multiple properties. source

Every property wrapper starts with word @propertyWrapper and have stored property of wrappedValue. On wrappedValue’s didSet we can put common validation or alteration logic. The type of wrappedValue should be same as of properties we are wrapping make sense right.

Note: In the above example, how we need to explicitly capitalize any string, that is pass into our initializer. Since property observers are only triggered after a value or object is initialize.

usage:

pretty cool 😎 right. You might wondering what is projectedValue. It can expose more functionality by defining a projected value property. You can access with $variableName. It can have different logic and type. Let us take other example where we need to trim string often.

Now you don’t need to call trimmingCharacters function all over the place. Adding @Trimmed in front of property takes care of itself, whenever you access it.

Let’s take another example, how we can revamp our existing usage or user defaults. which have lot’s of boilerplate code. credit

You can see how it is to retrieve and store value in userDefault. It is more elegant and swifty way of doing.

Known issues

Error handling is not yet supported may be include in future swift release. Where in you can try throw from property wrapper.

Composition is hard in property wrapper. Because the outermost wrapper is acting on a value of the innermost wrapper type. For more.

Conclusion

Do try property wrapper in your project. It will be great tool in you toolkit. Because it comes with swiftUI so in future chances are you are using this a lot in future so why not to try using it. Thanks for reading!

Resources

SwiftBySundell

NSHipster

Swift Doc

Thank you for reading!🚀 If you liked this article, please 👏 so other people can read it too :)

Follow me on Twitter for more.
What exactly mean by Copy on Write in Swift ?
Tags: Ipad Developer, Swift Programming, Copy On Write, Ios Development, Iphone App Development

If you are preparing for iOS interview this is the one of those questions interviewer is asking.

Copy on write says if two variables are supposed to hold exactly same value, then both of them should be pointing at same object unless mutation is needed.

Fig. Copy on Write in Swift

The new memory is created only when write operation is called. Till the time write operation is performed then only copy of object is created to avoid memory westage.

Why it is needed ?

To enhance the performance.

Consider following code snippet.

Snippet Copy on write example with array

Here, array1 and array2 both having same content. They are pointing to same memory location. You can see in the console output.

Snippet Copy on write example with array

Here, array1 and array2 both having different content. They are pointing to different memory location. You can see in the console output for reference.

Swift has already implemented copy on write for arrays and dictionaries.

But, not for custom objects.

That’s it for this concept. I really hope you liked the article.