macOS has been updated to 26 It's, But there has been no change in support for third-party input methods,Latest Xcode 26 Destroyed the method I had been using before - directly changed the compilation path to /Library/Input Method If you do this now, xcode will report an error,Because the framework the project depends on will no longer be written[……]
swift
When developing iOS apps,Many applications need to set the color of the iOS system status bar according to the current App content color,Black or white-especially on iOS 13 After the system supports the black mode。
Normal,Others will tell you to do this:
|
1 |
UIApplication.shared.statusBarStyle = .default |
But this triggers a warning:[crayon[……]
Many people will encounter in the development EXC_BAD_ACCESS ,I'm sorry,This time, Xcode does not give any detailed solutions。
usually,This is due to a memory error caused。In simple terms it is that you create an object A,But in the later time of the visit,A memory in this area have been moved to do the system he used,For example, put the object B here - your[……]
Processing time and date software development is a very common operation,Almost all programming languages provide a corresponding API to facilitate the development of the date and time to process,Swift is no exception,such as DateFormatter ,You can use it any Date
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[……]
Today, the group participants Someone made such a problem,Why use the characteristic dictionary type as a generic type constraint,It will inevitably error?
|
1 |
inheritance from non-protocol, non-class type 'Dictionary<String, Any>' |
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[……]
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 [pencil-6[……]
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[……]
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:
|
1 2 |
let info = Bundle.main.infoDictionary! version.text = "Version \(info["CFBundleShortVersionString"]!) (build \(info["CFBundleVersion"]!))" |
But
Background version number[……]
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[……]
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[……]
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[……]
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[……]
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:[……]
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 。
Now able to[……]
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。[……]
SQLite
Speaking SQLite,It is well known to you as MySQL,It is a relational database management system,But unlike the latter is that,It does not necessarily correspond completely independent server!
Generally speaking,SQLite is in the form of a file exist,Mostly used in embedded applications in storage。SQLite library is loaded by the application code,It can easily direct access to SQL[……]
In the process of writing the code,We will meet when the need to ensure that only one instance of the global,This time use the singleton pattern。
Single mode--this ensures that only one instance of a class,And provide a global point of access to。
What about how to implement the singleton pattern? We take a look at the classic Java code,How to implement the singleton pattern。
We had a quick search on the Internet "java singleton pattern" will be able to find[……]
While our Web development,Would inevitably have to obtain data from the Web server,In many cases also need to submit the data to the server,Which at the moment,We are used to using JSON formatted data,Because it is easy,This time we look,How to use Swift to send JSON-RPC command and get response。
JSON-RPC
JSON-RPC is a stateless and lightweight[……]