Swift uses InputMethodKit to write an input method

How to write an input method on iOS? This question has been answered a lot of people over。You can easily find a detailed tutorial by Google。but,On macOS write an input method is not so simple。

Ok,Strictly speaking,I mean use Swift to write a input method is difficult on macOS。The main reason is that no one has ever done this thing 。

Current data can be acquired,In addition to Apple's official API description (of no use),And the official demo (very detailed but outdated,而且[……]

Click link to continue reading...

Swift 3 GCD

Xcode 8 Official version has been released,I want the first time my project to the Swift 3 --After all, this is a trend。

During the migration process, I encountered a lot of problems--such as Xcode provides automated migration tool is not working,I've been waiting for more than two hours,after that I give up,I chose to manually migrate--after all,,Xcode's auto-correction is also very good。

However--in the process of migrating,Xcode has been in the "Indexing",Nor how full function may be due Swi ......[……]

Click link to continue reading...

Swift UIButton cornerRadius + shadow

Most of the time,We all want the button design style more in line with iOS,This will make the application interface does not look so jump,Even if the design does not look good,Nor was incompatible with the system。

"I'm not a designer,I don't know how to design beautiful style-but as close as possible to the system is not a wrong choice。 ” —— by Router

So it is for UIButton,Rounded corners + shadow should be the norm。

Put a picture

Obviously,This is the cheapest way - in fact the most expensive。It requires you to do a series of rounded picture for each button,[……]

Click link to continue reading...

OwnCloud build private clouds with personal

Background account

According to regulations of the country,All network disk must be reviewed! (Probably because too much goddess,You know = _ =),Then have stopped most of the network disk service,Now only some of the big manufacturers still operating in the cloud。but,You keep to a certain degree in the cloud all the information must be subject to review (the goddess of the film becomes 15 seconds educational films,It is light;If you say dang good,Or to save the file to a similar degree in the cloud,Tomorrow someone will come to your courier delivery…)and so,Against this background environment,I need to own a network disk (whatever you need to do not need,I need at least[……]

Click link to continue reading...

iOS custom keyboard around the keyboard to move the cursor implement

Until we are,For example, third-party input method Sogou input method has a classic gesture - paddling around on the keyboard to move the cursor。And this feature I am also very common,所以,I want to implement it yourself。

The first thing I think of is UISwipeGestureRecognizer ,However, with predictable results,Paddling can only move the cursor one space,This is not what I want。

It seems the only way is to use UIPanGestureRecognizer[……]

Click link to continue reading...

With Santa prevent Mac QQ start of Jietu.app

Update,The name of the new version of qq screenshot changed,To QQ jietu plugin.app ,Directory unchanged。

The following commands have been made corresponding modification。

We all know that QQ this thing and 360 A sample,Do no good,。A Mac version is also thought to function well with,First touches hooligan playing up。After this update,You will find QQ screenshot function independent of the (actually very early independence,I refer to the other),Network connection is not present and QQ[……]

Click link to continue reading...

Swift in regular expressions

At the beginning of a,Swift did not provide regular expression support,So we can only package,For example write a structure,Like this:

In fact, Swift already has support for regular expressions,We just need to:

Direct will be able to get the captured content。

 

Gets to be a[crayon[……]

Click link to continue reading...

Swift set cut scores

in most cases,If we want to get the contents of a section of the array (for example, front-to-middle,Some of the values ​​of the array or the last),This time you need to traverse the array to assign a new array:

Such an array of short, better said it does not matter,However, if the array is relatively large and we need to value and more,It is clear that it is a waste of time to traverse up。

Swift in itself provides an array of features split,This mechanism is called [crayon-676afb[……]

Click link to continue reading...

Let go pip Agent

When using python,Often you need to download some third-party framework,Fortunately, python has a similar apt package management tool,pip。

but,Although management packs can pip,But no source switching mirror,And we downloaded package,Most of the large foreign code hosting server,This often leads to a few hundred KB of package to download one hour。

 

Here we assume that,As a programmer you,Have been deployed to the computer HTTPS and HTTP proxy,We also said before[……]

Click link to continue reading...