diff --git a/TeenSau15/.DS_Store b/TeenSau15/.DS_Store new file mode 100644 index 0000000..9fe1e64 Binary files /dev/null and b/TeenSau15/.DS_Store differ diff --git a/TeenSau15/Teen sau 15/README.md b/TeenSau15/Teen sau 15/README.md new file mode 100644 index 0000000..0e75ce2 --- /dev/null +++ b/TeenSau15/Teen sau 15/README.md @@ -0,0 +1,86 @@ +# πŸŒ€ API Mashup β€” App Wing Event + +## πŸ“Œ What is API Mashup? + +API Mashup is an App Wing event where you build something *unforgettable*. + +You'll be given a fixed set of quirky, completely unrelated APIs and exactly **2.5 hours** to combine them into one single-screen mobile app (Android or iOS) that is creative, hilarious, and surprisingly functional. + +The twist? The APIs don't go together. That's the point. Your job is to make them feel like they were *meant* to be together. + +--- + +## 🎯 The Challenge + +* Build a **single-screen mobile app** (Android or iOS) in **2.5 hours** +* Integrate **3–4 APIs** from the provided list +* Display their data together in a **creative or entertaining way** +* The combo should feel clever, not forced + +--- + +## πŸš€ Submission Guidelines + +Please follow these steps carefully to ensure your project is evaluated: + +1. **Fork** this repository. +2. **Clone** your forked repository to your local machine. +3. Create a new **directory named after your team**. +4. **Initialize your project** within this directory (Android Studio or Xcode project). +5. **Showcase Video:** Record a 1–2 minute screen recording demonstrating your working project. Highlight the specific APIs and UI components you implemented. +6. **Attach Builds:** Include the link of downloadable APK file for Android and a zipped project file for Swift (Xcode) in the README. +7. **Commit & Push:** Add your project files, App screenshots and the showcase video (`.mp4` or a hosted link in your project's README) to your directory. +8. Open a **Pull Request (PR)** to this main repository before the **2.5-hour deadline**. + +--- + +## πŸ”Œ Available APIs + +| Category | API | What it does | Endpoint | +| :--- | :--- | :--- | :--- | +| Humor | Kanye Rest | Random Kanye West quotes | `https://api.kanye.rest` | +| Humor | Evil Insult | Creative / brutal insults | `https://evilinsult.com/generate_insult.php?lang=en&type=json` | +| Humor | Advice Slip | Random life advice | `https://api.adviceslip.com/advice` | +| Humor | Geek Jokes | Jokes for nerds & devs | `https://geek-jokes.sameerkumar.website/api?format=json` | +| Humor | Dad Jokes | Random dad jokes *(requires Accept header)* | `https://icanhazdadjoke.com/` | +| Humor | Chuck Norris | Chuck Norris facts & jokes | `https://api.chucknorris.io/jokes/random` | +| Humor | Yes/No API | Random yes or no answer + GIF | `https://yesno.wtf/api` | +| Fandom | Rick and Morty API | Characters & episodes | `https://rickandmortyapi.com/api/character` | +| Fandom | SWAPI | Star Wars planets, ships & people | `https://swapi.dev/api/people/1/` | +| Fandom | Disney API | Character filmography | `https://api.disneyapi.dev/character` | +| Fandom | Open Trivia DB | Trivia questions | `https://opentdb.com/api.php?amount=1` | +| Fun | Deck of Cards API | Shuffle & draw cards | `https://deckofcardsapi.com/api/deck/new/draw/?count=1` | +| Science | Spaceflight News | Real-time space news | `https://api.spaceflightnewsapi.net/v4/articles/` | +| Science | CelesTrak | Satellite / ISS tracking | `https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=json` | +| Creative | Robohash | Unique robot avatars from text | `https://robohash.org/your-text-here` (You can write any name here) | +| Creative | DiceBear Avatars | Cute pixel & custom avatars | `https://api.dicebear.com/7.x/pixel-art/svg?seed=John` (Refer this website if you want to change the style) | +| Animals | The Cat API | Random cat images | `https://api.thecatapi.com/v1/images/search` | +| Animals | The Dog API | Random dog images | `https://api.thedogapi.com/v1/images/search` | +| Animals | Dog CEO API | Random dog images by breed | `https://dog.ceo/api/breeds/image/random` | +| Utility | Random User | Fake identity generator | `https://randomuser.me/api/` | +| Utility | Dummy Json | Dummy Products Data | `https://dummyjson.com/products` | +| Utility | Agify | Predicts age from a name | `https://api.agify.io?name=michael` (You can use another name instead of michael too) | + +--- + +## πŸ† Judging Criteria + +| Criterion | What we're looking for | +| :--- | :--- | +| **Creativity** | How originally and imaginatively are the APIs used? | +| **Number of Features** | How many meaningful interactions and features did you build? | +| **Cohesion** | Do the APIs feel naturally connected, or does it feel like a forced mashup? | +| **Code Quality** | Clean, structured code β€” use of loggers, a repository pattern, smart list updates, a dedicated API client, etc. | + +### πŸ’‘ Bonus Points for: +* Using a **Repository pattern** to centralize all API calls (no cluttered `Activity.kt` or `ViewController.swift`) +* **DiffUtil** (Android) or **DiffableDataSource / Native SwiftUI Lists** (iOS) for smooth list updates +* Proper **logging** throughout the app +* **Error handling** and elegant loading states +* Smooth and polished UI despite the chaos + +--- + +> ⚠️ PRs submitted after the deadline will not be considered for judging. + +--- diff --git a/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.pbxproj b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.pbxproj new file mode 100644 index 0000000..7479b9b --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.pbxproj @@ -0,0 +1,576 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXContainerItemProxy section */ + 6BAC23162F8291A3006A7038 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6BAC23002F8291A1006A7038 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6BAC23072F8291A1006A7038; + remoteInfo = "Teen sau 15"; + }; + 6BAC23202F8291A3006A7038 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6BAC23002F8291A1006A7038 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6BAC23072F8291A1006A7038; + remoteInfo = "Teen sau 15"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 6BAC23082F8291A1006A7038 /* Teen sau 15.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Teen sau 15.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6BAC23152F8291A3006A7038 /* Teen sau 15Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Teen sau 15Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6BAC231F2F8291A3006A7038 /* Teen sau 15UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Teen sau 15UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 6BAC23552F82B39A006A7038 /* Exceptions for "Teen sau 15" folder in "Teen sau 15" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Untitled.swift, + ); + target = 6BAC23072F8291A1006A7038 /* Teen sau 15 */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 6BAC230A2F8291A1006A7038 /* Teen sau 15 */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 6BAC23552F82B39A006A7038 /* Exceptions for "Teen sau 15" folder in "Teen sau 15" target */, + ); + path = "Teen sau 15"; + sourceTree = ""; + }; + 6BAC23182F8291A3006A7038 /* Teen sau 15Tests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = "Teen sau 15Tests"; + sourceTree = ""; + }; + 6BAC23222F8291A3006A7038 /* Teen sau 15UITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = "Teen sau 15UITests"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6BAC23052F8291A1006A7038 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC23122F8291A3006A7038 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC231C2F8291A3006A7038 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6BAC22FF2F8291A1006A7038 = { + isa = PBXGroup; + children = ( + 6BAC230A2F8291A1006A7038 /* Teen sau 15 */, + 6BAC23182F8291A3006A7038 /* Teen sau 15Tests */, + 6BAC23222F8291A3006A7038 /* Teen sau 15UITests */, + 6BAC23092F8291A1006A7038 /* Products */, + ); + sourceTree = ""; + }; + 6BAC23092F8291A1006A7038 /* Products */ = { + isa = PBXGroup; + children = ( + 6BAC23082F8291A1006A7038 /* Teen sau 15.app */, + 6BAC23152F8291A3006A7038 /* Teen sau 15Tests.xctest */, + 6BAC231F2F8291A3006A7038 /* Teen sau 15UITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6BAC23072F8291A1006A7038 /* Teen sau 15 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6BAC23292F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15" */; + buildPhases = ( + 6BAC23042F8291A1006A7038 /* Sources */, + 6BAC23052F8291A1006A7038 /* Frameworks */, + 6BAC23062F8291A1006A7038 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 6BAC230A2F8291A1006A7038 /* Teen sau 15 */, + ); + name = "Teen sau 15"; + packageProductDependencies = ( + ); + productName = "Teen sau 15"; + productReference = 6BAC23082F8291A1006A7038 /* Teen sau 15.app */; + productType = "com.apple.product-type.application"; + }; + 6BAC23142F8291A3006A7038 /* Teen sau 15Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6BAC232C2F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15Tests" */; + buildPhases = ( + 6BAC23112F8291A3006A7038 /* Sources */, + 6BAC23122F8291A3006A7038 /* Frameworks */, + 6BAC23132F8291A3006A7038 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6BAC23172F8291A3006A7038 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 6BAC23182F8291A3006A7038 /* Teen sau 15Tests */, + ); + name = "Teen sau 15Tests"; + packageProductDependencies = ( + ); + productName = "Teen sau 15Tests"; + productReference = 6BAC23152F8291A3006A7038 /* Teen sau 15Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 6BAC231E2F8291A3006A7038 /* Teen sau 15UITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6BAC232F2F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15UITests" */; + buildPhases = ( + 6BAC231B2F8291A3006A7038 /* Sources */, + 6BAC231C2F8291A3006A7038 /* Frameworks */, + 6BAC231D2F8291A3006A7038 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6BAC23212F8291A3006A7038 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 6BAC23222F8291A3006A7038 /* Teen sau 15UITests */, + ); + name = "Teen sau 15UITests"; + packageProductDependencies = ( + ); + productName = "Teen sau 15UITests"; + productReference = 6BAC231F2F8291A3006A7038 /* Teen sau 15UITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6BAC23002F8291A1006A7038 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1640; + LastUpgradeCheck = 1640; + TargetAttributes = { + 6BAC23072F8291A1006A7038 = { + CreatedOnToolsVersion = 16.4; + }; + 6BAC23142F8291A3006A7038 = { + CreatedOnToolsVersion = 16.4; + TestTargetID = 6BAC23072F8291A1006A7038; + }; + 6BAC231E2F8291A3006A7038 = { + CreatedOnToolsVersion = 16.4; + TestTargetID = 6BAC23072F8291A1006A7038; + }; + }; + }; + buildConfigurationList = 6BAC23032F8291A1006A7038 /* Build configuration list for PBXProject "Teen sau 15" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6BAC22FF2F8291A1006A7038; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 6BAC23092F8291A1006A7038 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6BAC23072F8291A1006A7038 /* Teen sau 15 */, + 6BAC23142F8291A3006A7038 /* Teen sau 15Tests */, + 6BAC231E2F8291A3006A7038 /* Teen sau 15UITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6BAC23062F8291A1006A7038 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC23132F8291A3006A7038 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC231D2F8291A3006A7038 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6BAC23042F8291A1006A7038 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC23112F8291A3006A7038 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6BAC231B2F8291A3006A7038 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6BAC23172F8291A3006A7038 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6BAC23072F8291A1006A7038 /* Teen sau 15 */; + targetProxy = 6BAC23162F8291A3006A7038 /* PBXContainerItemProxy */; + }; + 6BAC23212F8291A3006A7038 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6BAC23072F8291A1006A7038 /* Teen sau 15 */; + targetProxy = 6BAC23202F8291A3006A7038 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 6BAC23272F8291A3006A7038 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = U8PBM33L3T; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 6BAC23282F8291A3006A7038 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = U8PBM33L3T; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6BAC232A2F8291A3006A7038 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6BAC232B2F8291A3006A7038 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 6BAC232D2F8291A3006A7038 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Teen sau 15.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Teen sau 15"; + }; + name = Debug; + }; + 6BAC232E2F8291A3006A7038 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Teen sau 15.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Teen sau 15"; + }; + name = Release; + }; + 6BAC23302F8291A3006A7038 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15UITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = "Teen sau 15"; + }; + name = Debug; + }; + 6BAC23312F8291A3006A7038 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PBM33L3T; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.shambhavi.Teen-sau-15UITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = "Teen sau 15"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6BAC23032F8291A1006A7038 /* Build configuration list for PBXProject "Teen sau 15" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6BAC23272F8291A3006A7038 /* Debug */, + 6BAC23282F8291A3006A7038 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6BAC23292F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6BAC232A2F8291A3006A7038 /* Debug */, + 6BAC232B2F8291A3006A7038 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6BAC232C2F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6BAC232D2F8291A3006A7038 /* Debug */, + 6BAC232E2F8291A3006A7038 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6BAC232F2F8291A3006A7038 /* Build configuration list for PBXNativeTarget "Teen sau 15UITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6BAC23302F8291A3006A7038 /* Debug */, + 6BAC23312F8291A3006A7038 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6BAC23002F8291A1006A7038 /* Project object */; +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/xcuserdata/ibaaubaa.xcuserdatad/UserInterfaceState.xcuserstate b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/xcuserdata/ibaaubaa.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..7b6e0b6 Binary files /dev/null and b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/project.xcworkspace/xcuserdata/ibaaubaa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/xcuserdata/ibaaubaa.xcuserdatad/xcschemes/xcschememanagement.plist b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/xcuserdata/ibaaubaa.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..af20d48 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15.xcodeproj/xcuserdata/ibaaubaa.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Teen sau 15.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AccentColor.colorset/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AppIcon.appiconset/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Contents.json new file mode 100644 index 0000000..7c9b495 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Image.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Image.jpg b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Image.jpg new file mode 100644 index 0000000..071c596 Binary files /dev/null and b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/Image.imageset/Image.jpg differ diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Contents.json new file mode 100644 index 0000000..17f6fd9 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Image.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Image.png b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Image.png new file mode 100644 index 0000000..2744d4d Binary files /dev/null and b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/bd.imageset/Image.png differ diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/Contents.json b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/Contents.json new file mode 100644 index 0000000..1bba1d2 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "hehe.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/hehe.png b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/hehe.png new file mode 100644 index 0000000..f34a0b9 Binary files /dev/null and b/TeenSau15/Teen sau 15/Teen sau 15/Assets.xcassets/hehe.imageset/hehe.png differ diff --git a/TeenSau15/Teen sau 15/Teen sau 15/ContentView.swift b/TeenSau15/Teen sau 15/Teen sau 15/ContentView.swift new file mode 100644 index 0000000..b12a2a4 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/ContentView.swift @@ -0,0 +1,164 @@ + +import SwiftUI +import UIKit + +struct ContentView: View { + + @State private var showUserPopup = false + @State private var name = "" + @State private var age: Int? + @State private var goToGame = false + + var body: some View { + NavigationStack { + ZStack { + + Image("Image") + .resizable() + .scaledToFill() + .ignoresSafeArea() + + VStack(spacing: 50) { + + Image("hehe") + .resizable() + .scaledToFill() + .frame(width: 150, height: 150) + .clipShape(Circle()) + .shadow(color: Color(#colorLiteral(red: 0.7758647799, green: 0.9381300807, blue: 0.2157115638, alpha: 1)), radius: 30) + .padding(.top, 60) + + VStack { + Button(action: loginUser) { + Text("START") + .font(.headline) + .frame(maxWidth: .infinity) + .padding() + .background( Color(#colorLiteral(red: 0.7758647799, green: 0.9381300807, blue: 0.2157115638, alpha: 1))) + .foregroundColor(.black) + .cornerRadius(15) + } + } + .frame(width: 320, height: 90) + .padding() + .background( + RoundedRectangle(cornerRadius: 25) + .fill(Color.black) + ) + Image("bd") + .resizable() + .scaledToFill() + .frame(width: 250, height: 150) + .padding(.top, 80) + .clipShape(Rectangle()) + + + Spacer() + } + + // Popup + if showUserPopup { + ZStack { + Color.black.opacity(0.6).ignoresSafeArea() + + VStack(spacing: 20) { + + Text("Your Fake Identity πŸ‘€") + .foregroundColor(.white) + + Text(name) + .font(.title) + .foregroundColor(.green) + + if let age = age { + Text("Age: \(age)") + .foregroundColor(.white) + } + + Button("Predict Age") { + fetchAge() + } + .padding() + .background(Color.green) + .foregroundColor(.black) + .cornerRadius(10) + + Button("Continue 😈") { + showUserPopup = false + goToGame = true + } + .foregroundColor(.green) + } + .padding() + .background(Color.black) + .cornerRadius(20) + } + } + + // Navigation trigger + NavigationLink( + destination: ContentView2(firstName: name.components(separatedBy: " ").first ?? ""), + isActive: $goToGame + ) { EmptyView() } + } + } + } + + // API Calls + func loginUser() { + fetchRandomUser() + } + + func fetchRandomUser() { + let url = URL(string: "https://randomuser.me/api/")! + + URLSession.shared.dataTask(with: url) { data, _, _ in + if let data = data { + let decoded = try? JSONDecoder().decode(RandomUserResponse.self, from: data) + + DispatchQueue.main.async { + let user = decoded?.results.first + name = "\(user?.name.first ?? "") \(user?.name.last ?? "")" + showUserPopup = true + } + } + }.resume() + } + + func fetchAge() { + let first = name.components(separatedBy: " ").first ?? "" + let url = URL(string: "https://api.agify.io?name=\(first)")! + + URLSession.shared.dataTask(with: url) { data, _, _ in + if let data = data { + let decoded = try? JSONDecoder().decode(AgeResponse.self, from: data) + + DispatchQueue.main.async { + age = decoded?.age + } + } + }.resume() + } +} + +// Models +struct RandomUserResponse: Codable { + let results: [User] +} + +struct User: Codable { + let name: Name +} + +struct Name: Codable { + let first: String + let last: String +} + +struct AgeResponse: Codable { + let age: Int? +} + +#Preview { + ContentView() +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/README.md b/TeenSau15/Teen sau 15/Teen sau 15/README.md new file mode 100644 index 0000000..b54eb6b --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/README.md @@ -0,0 +1,4 @@ +// https://youtube.com/shorts/oSKqi-2HIQw?si=lJ_-dloEK6UrAjTC +//BAD DECISION ONLY: +//Our App basically uses 5 public APIs , the first one being the one generating a random name for the user after the click of a button and the next one being the one that predicts the age of the user from the name entered , the user is then directed to another page where the user gets a custom avatar of his name (using a pixel avatar generator public api) , and then begins the main part where the user asks the app questions- answerable as yes or no , and then the system respons with an YES or NO(using the random question API) , after the question is answered we get the display of a suitable meme (using the roast/meme app) . +// our app helps you choose an answer to the questions you were unsure about- ENJOY! diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Teen_sau_15App.swift b/TeenSau15/Teen sau 15/Teen sau 15/Teen_sau_15App.swift new file mode 100644 index 0000000..d52c200 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/Teen_sau_15App.swift @@ -0,0 +1,17 @@ +// +// Teen_sau_15App.swift +// Teen sau 15 +// +// Created by Shambhavi Verma on 05/04/26. +// + +import SwiftUI + +@main +struct Teen_sau_15App: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15/Untitled.swift b/TeenSau15/Teen sau 15/Teen sau 15/Untitled.swift new file mode 100644 index 0000000..e69de29 diff --git a/TeenSau15/Teen sau 15/Teen sau 15/cv2.swift b/TeenSau15/Teen sau 15/Teen sau 15/cv2.swift new file mode 100644 index 0000000..5b27ba2 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15/cv2.swift @@ -0,0 +1,138 @@ +import SwiftUI + +struct ContentView2: View { + + var firstName: String + + @State private var question = "" + @State private var answer = "" + @State private var imageURL = "" + @State private var insult = "" + + var body: some View { + ZStack { + + Color.black.ignoresSafeArea() + + VStack(spacing: 25) { + + Text("Your Digital Twin 🧬") + .foregroundColor(.green) + .font(.title2) + + // βœ… FIXED AVATAR (PNG instead of SVG) + AsyncImage(url: URL(string: "https://api.dicebear.com/7.x/pixel-art/png?seed=\(firstName)")) { image in + image.resizable() + } placeholder: { + ProgressView() + } + .frame(width: 150, height: 150) + .clipShape(Circle()) + .shadow(color: .green, radius: 20) + + Text(firstName) + .foregroundColor(.white) + .font(.title) + + Divider().background(Color.green) + + // βœ… USER INPUT + TextField("Type your question...", text: $question) + .padding() + .background(Color.white) + .cornerRadius(10) + .foregroundColor(.black) + + // ANSWER + if !answer.isEmpty { + Text(answer.uppercased()) + .font(.largeTitle) + .foregroundColor(.green) + } + + // GIF + if !imageURL.isEmpty { + AsyncImage(url: URL(string: imageURL)) + .frame(width: 200, height: 200) + } + + // BUTTON + Button("ASK 😈") { + playGame() + } + .padding() + .background(Color.green) + .foregroundColor(.black) + .cornerRadius(12) + + // ROAST + if !insult.isEmpty { + Text(insult) + .foregroundColor(.red) + .padding() + .multilineTextAlignment(.center) + } + + Spacer() + } + .padding() + } + } + + // MARK: - Game Logic + + func playGame() { + guard !question.isEmpty else { return } + + answer = "" + insult = "" + + fetchYesNo() + } + + func fetchYesNo() { + let url = URL(string: "https://yesno.wtf/api")! + + URLSession.shared.dataTask(with: url) { data, _, _ in + if let data = data { + let decoded = try? JSONDecoder().decode(YesNoResponse.self, from: data) + + DispatchQueue.main.async { + answer = decoded?.answer ?? "" + imageURL = decoded?.image ?? "" + + fetchInsult() + } + } + }.resume() + } + + func fetchInsult() { + let url = URL(string: "https://evilinsult.com/generate_insult.php?lang=en&type=json")! + + URLSession.shared.dataTask(with: url) { data, _, _ in + if let data = data { + let decoded = try? JSONDecoder().decode(InsultResponse.self, from: data) + + DispatchQueue.main.async { + insult = decoded?.insult ?? "" + } + } + }.resume() + } +} + +// MARK: - Models + +struct YesNoResponse: Codable { + let answer: String + let image: String +} + +struct InsultResponse: Codable { + let insult: String +} + +#Preview { + ContentView2(firstName: "John") +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15Tests/Teen_sau_15Tests.swift b/TeenSau15/Teen sau 15/Teen sau 15Tests/Teen_sau_15Tests.swift new file mode 100644 index 0000000..5ab4eb4 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15Tests/Teen_sau_15Tests.swift @@ -0,0 +1,17 @@ +// +// Teen_sau_15Tests.swift +// Teen sau 15Tests +// +// Created by Shambhavi Verma on 05/04/26. +// + +import Testing +@testable import Teen_sau_15 + +struct Teen_sau_15Tests { + + @Test func example() async throws { + // Write your test here and use APIs like `#expect(...)` to check expected conditions. + } + +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITests.swift b/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITests.swift new file mode 100644 index 0000000..78b34bf --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITests.swift @@ -0,0 +1,41 @@ +// +// Teen_sau_15UITests.swift +// Teen sau 15UITests +// +// Created by Shambhavi Verma on 05/04/26. +// + +import XCTest + +final class Teen_sau_15UITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + @MainActor + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + @MainActor + func testLaunchPerformance() throws { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } +} diff --git a/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITestsLaunchTests.swift b/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITestsLaunchTests.swift new file mode 100644 index 0000000..7b9d894 --- /dev/null +++ b/TeenSau15/Teen sau 15/Teen sau 15UITests/Teen_sau_15UITestsLaunchTests.swift @@ -0,0 +1,33 @@ +// +// Teen_sau_15UITestsLaunchTests.swift +// Teen sau 15UITests +// +// Created by Shambhavi Verma on 05/04/26. +// + +import XCTest + +final class Teen_sau_15UITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +}