Swift

Apple's new place of OC for a high-level programming language!

Let iOS macOS Chinese font achieve visual vertical centering

In the development off the grid when the input method macOS,I encountered a problem of a more wonderful,This problem has plagued me now - the time when some places need to display a row of vertically centered text,How to make these characters real "center"?

 

At first glance this seems to make much sense,Well ...... like vertical center,On macOS [crayon-661ee9411b5089[……]

Click link to continue reading...

Swift in the array to re-program

When developed using Swift input pocketed,I met a very interesting question -Deduplication

All to known,Candidate input method in the calculation will always be out there may be a duplicate options (such as code table and have a word in the lexicon,They may be different coding,But the word is the same and the like),This time you need to re,But while keeping the same order of candidates。

Others solutions

If you go online to find,Then[……]

Click link to continue reading...

swift4 urlSession get and post requests network

Ado,Directly on the code。

GET:

POST:

 [……]

Click link to continue reading...

How to use dictionary types as generic constraints in Swift

Today, the group participants Someone made such a problem,Why use the characteristic dictionary type as a generic type constraint,It will inevitably error?

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

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

Click link to continue reading...

NSTextField text blur solution canDrawSubviewsIntoLayer

Among developing pocketed input process macOS,I have been plagued by a strange question - text blurred。

Sub-pixel

No matter how I debug,Pocketed candidate text input method can not achieve the original text as clear and sharp。After a big ask God,The resulting experience is to see live a long time - upstreamSub-pixel rendering bug。

In many platforms have similar problems,macOS[……]

Click link to continue reading...