MarcosAtMorais/TypeEffectivenessKit
Want to know what to use when battling a Pokémon? TypeEffectivenessKit is here to help you with all types.
TypeEffectivenessKit is a Type Effectiveness Checker for all kinds of Pokémon Types and Pokémon Move Types. With TypeEffectivenessKit, you'll be able to have a simple yet flexible framework to work with.
✨ Features
- Type Weaknesses: No Effect, Barely Effective (1/4), Not Very Effective (1/2), Effective, Super Effective (2x) and Ultra Effective (4x).
- The relationships are all ready. Both for Single and Dual Types. A PokemonType has its weaknesses, as well as some identifiers.
- Easily check a type. Just bring the method for Checking Effectiveness and you'll be able to check everything.
- Built Swifty and with lightweight in mind.
- 100% Swift.
- Three examples are included in the package. All using SwiftUI, following architectural patterns and leveraging SwiftUI's power.
- Fully documented and tested.
- Updated from the latest games released.
- This will be very useful especially for Terastal Pokémon and Tera Raid Battles on the brand-new games.
🚀 Get Started
Using TypeEffectivenessKit in Production Code
Just import TypeEffectivenessKit:
import TypeEffectivenessKitThen, you can use it as you please. Like this quick example using single types:
let pokemonType: PokemonType = .fire
let moveType: PokemonType = .water
let effectiveness = pokemonType.checkSingleTypeEffectiveness(offensiveType: moveType)
print(effectiveness.localized) // Super EffectiveAn example using a Pokémon that has two types. This is one option:
let pokemonFirstType: PokemonType = .fire
let pokemonSecondType: PokemonType = .ghost
let moveType: PokemonType = .grass
let effectiveness = pokemonFirstType.checkDualTypeEffectiveness(otherType: pokemonSecondType, offensiveType: moveType)
print(effectiveness.localized) // Not Very EffectiveAnother example using Dual Type Pokémon, now using a struct named DualType that includes it with a convenience method:
let pokemonFirstType: PokemonType = .fairy
let pokemonSecondType: PokemonType = .psychic
let dualType = DualType(firstType: pokemonFirstType, secondType: pokemonSecondType)
let moveType: PokemonType = .dragon
let effectiveness = dualType.fetchTypeEffectivenessAccordingTo(moveType)
print(effectiveness.localized) // No EffectThis package also includes several SwiftUI views that display the types, color and symbols in a stylish way. As well as grids and stacks. You can use these views as you please. Explore 'em all!
📱 Example App for educational purposes
TypeEffectivenessKit also comes with several scenes that you can learn from for how to use types. Such as this one and many others:
All examples are located on the View folder, but the elements should be able to be used just with the package import.
🔨 Swift Package Manager
You can also add this library using Swift Package Manager.
- Go to File > Add Packages.
- The Add Package dialog will appear, by default with Apple packages.
- In the upper right hand corner, paste https://github.com/MarcosAtMorais/TypeEffectivenessKit into the search bar.
- Hit Return to kick off the search.
- Click Add Package.
- You're all set! Just import TypeEffectivenessKit whenever and wherever you want to use it.
🌟 Requirements
iOS 15+
macOS 12+
watchOS 7+
tvOS 14+
💭 Related
This package is just for hobby and educational purposes. It may not be used for commercial releases. Pokémon is a trademark of Nintendo, Game Freak, The Pokémon Company and Creatures Inc. No copyright or trademark infringement is intended.

