The Configurations.swift
file
Open this file in Xcode and keep reading this guide, you'll have to perform some edits in this file in order to get your template ready to run:
App Name
Replace this string with the new name you want to give to this app:
let APP_NAME = "Opposite"
AdMob Ads
Replace the string of the variable below with your own
Interstitial Unit ID - you have to create such Unit ID on
apps.admob.com, just follow the instructions on the AdMob's website in case you don't know how to generate a Unit ID:
let ADMOB_INTERSTITIAL_UNIT_ID = "ca-app-pub-3940256099942544/1033173712"
You also have to replace the string into
Info.plist
with your own App ID:
You can get both
App ID and
Unit ID strings from your AdMob Unit page, after creating it:
Sometimes Apple reviewers reject apps because of Ads, the reason why is not clear yet, but a new submission on the App Store will fix the problem and get your app approved - just in case you'll get a rejection because of IDFA issue.
Anyway, after clicking the Submit For Review button on the App Store Connect page of your application, you’ll get something that looks like the picture below. Mark the options shown below and everything should go smoothly on the next review you'll get of your app:
Custom Colors
You can edit the
HEX
values of the following variables as you wish, change the numbers before
#
symbol. The main color of the app and some UI will be affected by your change:
let TOP_COLOR = hexValue(hex: "#8FDAF4")
let BOTTOM_COLOR = hexValue(hex: "#48CFAE")
let YELLOW_COLOR = hexValue(hex: "#F6D55C")
PLEASE NOTE that NOT all Views in the app will change accordingly to the new RGB values you've set in the above variable, you will still need to adjust some colors in some Controllers in the Storyboard.
Custom fonts
This App uses
Futura font, which is already stored into the Xcode Fonts library.
In case you want to add a new font, you have to first drag your
.ttf
or
.otf
font file into the left-side panel in Xcode and click the Finish button in the popup that will show up:
Then select the Label, Button, TextFiled or textView you want to change font to, click the
[T]
icon on the right-side
Attributes inspector panel and select the font you want in the dropdown list:
List of English and Italian words with their hints
Check the following arrays:
let ENWords = [
"'MOISTURE'-DRY-WET",
"'TEMPERATURE'-HOT-COLD",
"'STATES OF DAY'-DAY-NIGHT",
"'DIRECTIONS'-ABOVE-BELOW",
"'GOOD AND BAD'-ANGEL-DEVIL",
"'AGES'-ADULT-CHILD",
"'CONDITION OF LIFE'-ALIVE-DEAD",
"'QUANTITY'-ALL-NONE",
"'DAY AND NIGHT'-SUN-MOON",
"'THINGS HAPPEN'-ALWAYS-NEVER",
"'COLORS'-BLACK-WHITE",
"'SEASONS'-WINTER-SUMMER",
"'DIRECTIONS'-FRONT-BACK",
"'SOON OR LATER'-BEFORE-AFTER",
"'BETTER OR NOT'-BEST-WORST",
"'SIZE'-BIG-SMALL",
"'CUTTING'-SHARP-BLUNT",
"'STUFF CONDITION'-OLD-NEW",
// YOU CAN ADD WORDS HERE (THE NUMBER OF ITEMS OF THIS ARRAY MUST BE EQUAL TO THE OTHER ONES - PLEASE REFER TO THE DOCUMENTATION)
]
let ITWords = [
"'TEMPERATURA'-FREDDO-CALDO",
"'STATI DELLA GIORNATA'-GIORNO-NOTTE",
"'GIORNO E NOTTE'-SOLE-LUNA",
"'DIREZIONI'-SOPRA-SOTTO",
"'GENITORI' '-PADRE-MADRE",
"'PARTI DEL MONDO'-TERRA-CIELO",
"'VIVERE E...'-VIVO-MORTO",
"'QUANTITA' '-TUTTO-NIENTE",
"'COLORI'-BIANCO-NERO",
"'LE COSE ACCADONO'-SEMPRE-MAI",
"'CONDIZIONE DI UN OGGETTO'-VECCHIO-NUOVO",
"'DIREZIONI'-FRONTE-RETRO",
"'ARRIVARE IN TEMPO'-PRIMA-DOPO",
"'ALFA E OMEGA'-INIZIO-FINE",
"'PUO' DIVENTARE SOLIDO'-ACQUA-GHIACCIO",
"'ASPETTO FISICO'-BELLO-BRUTTO",
"'ESSERE UMANO'-ANIMA-CORPO",
"'CUTTING'-SHARP-BLUNT",
// YOU CAN ADD WORDS HERE (THE NUMBER OF ITEMS OF THIS ARRAY MUST BE EQUAL TO THE OTHER ONES - PLEASE REFER TO THE DOCUMENTATION)
]
You may notice that each of the above arrays name is made by the first 2 language code digits (
EN
for English,
IT
for Italian).
If you want to add a new array of words, let's says a
German array, follow these steps:
- Copy the
ENWords
array
- Paste it below the
ITWords
array
- Rename your new array into
GEWords
and edit all its items into the words and hints you want for the German language
After you've added your new array of words and hints, you may need to add your language's alphabet list, like the English and Italian ones of these variables:
let ENAlphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
let ITAlphabet = ["A","B","C","D","E","F","G","H","I","L","M","N","O","P","Q","R","S","T","U","V","Z"]
In this case, copy the
ENAlphabet
array and paste it below the
ITAlphabet
one, name it
GEAlphabet
and set all the characters of the alphabet of that language. here's an example of how it should look:
let GEAlphabet = ["A","B","C","D", ...etc. ]
Then you need to add your new language name into the following array:
let languagesArray = [
"English",
"Italiano",
]
So add
"German",
right below
"Italiano"
.
You have also to add all translated strings into the
setTextsIntoSelectedlanguage(_ language: String)
function. Thake the existing switch cases as an example, copy the code from
case "English":
to
break
and paste it below the following comment:
// YOU CAN ADD TRANSLATIONS HERE - PLEASE REFER TO THE DOCUMENTATION
Then edit all the strings into your new language (here's an example):
// German
case "German":
LANGUAGE = "GERMAN",
etc...
...
break
One last thing to do is to enter
GameScreen.swift
and check the beginning of the
loadWords()
function:
switch selectedLanguage {
case "English": alphabet = ENAlphabet; wordsArr = ENWords[lastLevel].components(separatedBy: "-"); break
case "Italiano": alphabet = ITAlphabet; wordsArr = ITWords[lastLevel].components(separatedBy: "-"); break
// YOU CAN ADD YOU CASES HERE IN CASE YO HAVE ADDED SOME MORE LANGUAGE (PLEASE REFER TO THE DOCUMENTATION)
Below that comment, you must add a line like this (still considering the
German language as an example):
case "German": alphabet = GEAlphabet; wordsArr = GEWords[lastLevel].components(separatedBy: "-"); break
PLEASE NOTE: Each item of the arrays is made by
3 words:
- The 1st one is between
' '
because it's a hint, and it'll be shown on the top of the screen, below the LEVEL number.
- The 2nd and 3rd words are the words that players have to guess, one is the opposite meaning of the other.
If you want to add new items to the arrays, just keep their formatting style, which separates hint and words by the
-
symbol.
Example: let's pretend you want to add
COLD and
HOT in the
ENwords
array, you have to think about an hint and add a line like this:
"'TEMPERATURE'-HOT-COLD",
PLEASE NOTE that the number of items of an array, either the
ENWords
or the
ITwords
one (or even a new array of words you may add),
must be the same, which means that if the
ENWords
array has 20 items, for instance, all the other arrays must have 20 items as well.
IMPORTANT: The maximum number of characters allowed for each of the 2 words to guess is 6
, so do not insert words that are longer than 6 characters otherwise the app will crash. Instead, for the hint
string, you can type anything, anyway just make it short an clear, it must be a simple hint to helpo player to guess the 2 wprds, not the solution to them :)
Sound clips
There's a folder in Xcode called
Sounds which contains a few
.wav
files, you may replace those sound clips with other
.wav
files, just don't rename them, name your new sound files like the esisting ones and replace the existing ones with your new ones, so you won't have to edit a single line of code.
Utility Functions
Unless you are familiar with iOS programming, you should leave the code of this section as it is since it includes useful functions to show alerts and perform other things in the app.