[SWIFT] [Gachi consideration] About abbreviations of English words that are often used when naming variables

KIT Adcare It's the 15th day. Yesterday was @ nagutabby's "Scraping to find out the market price of used products". It was very interesting because I was holding my head just to know the market price of used products.


When I'm doing personal development and naming variables and functions, I often wonder "what name should I use ...". However, when I try to describe the function in more detail, I tend to give it a long name ... In this article, I will introduce abbreviations of English words that I often use when writing Swift, and new abbreviations (I don't know if they can be used) that I took the opportunity to write this article.

Frequently used abbreviation

img Abbreviation for image, look closely

num Abbreviation for number, enter some number

cnt Abbreviation for count, used in variable names when counting something

prog Abbreviation for program, I feel like I used it somewhere

txt Abbreviation for text, it is also used in the extension of text files, so it may be a little confusing

msg Be careful not to mistake it for massage, which is an abbreviation for message.

ans Abbreviation for answer, used when receiving a reply. Image that seems to be used in competition professionals

upd Abbreviation for update, it is used for functions that update values. However, if "update" is included in the function name implemented as standard, I feel that it is better to unify it.

ctrl Abbreviation for Control, which is often used with the Control key on the keyboard.

VC Abbreviation for ViewController, used when defining an instance Look closely

hogeVC = HogeViewController()

btn Abbreviation for button, basically used with words that modify the button itself I often see this too

sendDataBtn: UIButton()! //Button to send data somewhere (probably)

nav Abbreviation for navigation, navigate, often used when giving a function name with a screen transition function, etc.


tappedNavBtn()//This and that when you tap the button

Short form that I thought of myself

Next, I will introduce the abbreviations that I thought of as a textbook that I might be able to use.

chk chker An abbreviation for check checker, it seems that it can be used in a function that has a process to check something The name of the variable that stores the Bool type value used when judging something.

temp Abbreviation for template It seems that it is not practical because you can associate various words such as template, temperature, temple, tempura from "temp".

lbl Abbreviation for label, not the absolute value of b. Don't just say "I can't shorten it if it's about label in the first place"

rep Abbreviation for reply, it's called "rip" on SNS, so can I use it? I thought

sus Abbreviation for suspend * It is not the one I thought of myself. The other day, when I was doing the smartphone version of among_us, I saw the string "sus". When I looked it up, it seems to be an abbreviation for "suspend" in overseas net slang. If you can use it with among_us, you should use it with programming

ipc Abbreviation for imagePickerController Assumption to be used when creating an instance

let ipc = imagePickerController()

Practice

Let's actually name it using the abbreviations introduced so far.

Variable to count numbers

var numCnt = 0

A function that runs when a button with a function to update the displayed image is pressed

tappedshowImgUpdBtn()

ViewController that lists messages from massage shops and temples and images of tempura along with the temperature of the day

msgTempMsgAndTempImgAndTempListVC = ...

image.png

Use the abbreviations of English words moderately and with moderation.

Tomorrow is an article by @daikimare.

Recommended Posts

[Gachi consideration] About abbreviations of English words that are often used when naming variables
java stream A memorandum of intermediate / termination operations that are really often used 1