Categories
Swift

String.count vs NSString.length

generally speaking,Swift inner String And it is NSString Bridged,For example, I have written String NSString and what difference?,In short we are here to discuss major,String[……]

Click link to continue reading...

Categories
Swift

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...

Categories
Swift

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...

Categories
Swift

Timer can not update the UI while dragging

In iOS development,We often use Timer This class,For some repeat or delayed call。

but,In actual use,If you are used to periodically update the UI,Will be found Timer Call often[……]

Click link to continue reading...

Categories
Mac OS Swift

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...

Categories
Swift

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...

Categories
Swift

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...

Categories
Swift R0uter Input Tool

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...

Categories
Swift

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...