Swift how to use a dictionary as a paradigm constraints

Today, the group participants Someone made such a problem,Why dictionary type characteristics as the paradigm of the time constraint type,It will inevitably error?

Obviously,He said very clearly,"You can not be from a non-agreement、Non-type class inheritance. "。Obviously,A dictionary is a paradigm structure ......

Then the solution is also very clear ideas,Create[……]

Click link to continue reading...

Pocketed X input method is how to deal with the problem of delayed edge of the screen

Problem

Pocketed in the development process input,I have always been plagued by a problem,That is when the user clicks on the left edge of the screen, UIButton of touchDown event almost turned into a [crayon-5[……]

Click link to continue reading...

Xcode automatic version

Make sure developers have had such trouble:Version submitted wrong!

Version of the compiler and testing more,When the inevitable submitted only to find the wrong version number。Or is the background version number is correct,Reception forget to change the version number。In fact,Allows reception automatically obtain the version number of the background data,For example, this:

But

Background version number[……]

Click link to continue reading...

A stack automatically sorted Swift

a year ago,I'm here git onReleased aSwift used to achieve stack,There are two versions。Because Swift itself does not achieve this thing - even though the official part of the tutorial is to use genericsThe StackExamples cited。

Perhaps people think this is too simple, right

In short,This time I play this thing,Because the HMM Viterbi algorithm needs to be done to trim,Otherwise, too many unnecessary path[……]

Click link to continue reading...

Swift is determined whether there is a string expression Emoji

Update:The network spread emoji Code pointNot complete,I follow Wikipedia-refresh a bit,The paper version of the code was updated Swift。

Many times we need to determine a character、Or that there is not a word that contains the emoji,Use Swift language development app is no exception,For example, you can use a regular expression - but unfortunately,It seems different languages[……]

Click link to continue reading...

A quick look at the string

Most of the time,We need to look at many strings,To determine the specific content filtering out。For example, through the input method which pocketed,We need to use auxiliary code word to filter out candidates need。

In General,Find and Compare certainly figures to fastest,However, in the lexicon we can not put all the words are converted to digital (although theoretically feasible ......) search on the string,We realize there are many ways to,Here, I say my own ideas[……]

Click link to continue reading...

Memory Problems swift hurricane

Swift language development in the use of time,Many of my friends will be baffling problem encountered memory full,Obviously there ARC ,Obviously the release of memory,But still let the program memory footprint with circulation soared。

There is not really a memory leak occurs,This is actually ARC A mechanism:In each of the main Runloop At the end of the clean-up。That is,It is necessary to have a cache[……]

Click link to continue reading...

SourceKitService take up a lot of memory and CPU solutions

Swift performed using Xcode development software language when,Many people in the latter part of the project will encounter such a problem,If that diagram as:SourceKitService Take up a lot of CPU and memory,Or even directly cause the system stuck。

Then,This in the end is how it all about? StuckOverflow of the vote on the answer is to say:[……]

Click link to continue reading...