{"id":27226246,"url":"https://github.com/mumble-srl/mbadminswift","last_synced_at":"2025-09-10T08:33:31.283Z","repository":{"id":42443254,"uuid":"217081494","full_name":"Mumble-SRL/MBAdminSwift","owner":"Mumble-SRL","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-02T06:45:58.000Z","size":1609,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T13:36:34.097Z","etag":null,"topics":["carthage","cocoapods","mburger","swift","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mumble-SRL.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-23T14:44:06.000Z","updated_at":"2024-08-02T06:44:18.000Z","dependencies_parsed_at":"2024-08-02T08:05:21.185Z","dependency_job_id":null,"html_url":"https://github.com/Mumble-SRL/MBAdminSwift","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.12903225806451613","last_synced_commit":"deb53ca8555560ad8fc820d571524679bc478050"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mumble-SRL%2FMBAdminSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mumble-SRL%2FMBAdminSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mumble-SRL%2FMBAdminSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mumble-SRL%2FMBAdminSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mumble-SRL","download_url":"https://codeload.github.com/Mumble-SRL/MBAdminSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215196,"owners_count":21066622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","cocoapods","mburger","swift","xcode"],"created_at":"2025-04-10T11:55:09.968Z","updated_at":"2025-04-10T11:55:10.640Z","avatar_url":"https://github.com/Mumble-SRL.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Mumble-SRL/MBurgerSwift/master/Images/mburger-icon.png\" alt=\"MBurger Logo\" title=\"MBurger Logo\"\u003e\n\u003c/p\u003e\n\n[![Documentation](https://img.shields.io/badge/documentation-100%25-brightgreen.svg)](https://github.com/Mumble-SRL/MBAdminSwift/tree/master/docs)\n[![](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat)](https://swift.org/package-manager/)\n![Cocoapods](https://img.shields.io/badge/pod-v1.0.6-blue.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/badge/License-Apache%202.0-yellow.svg)](LICENSE)\n\n\n\n# MBAdmin\n\nIn the MBAdmin package you can find the functions to edit the sections of MBurger.\nYou will have to use a token with write permissions to edit the sections and with delete permission to delete them.\n\n# Installation\n\n## Swift Package Manager\n\nWith Xcode 11 you can start using [Swift Package Manager](https://swift.org/package-manager/) to add **MBAdmin** to your project. Follow those simple steps:\n\n* In Xcode go to File \u003e Swift Packages \u003e Add Package Dependency.\n* Enter `https://github.com/Mumble-SRL/MBAdminSwift.git` in the \"Choose Package Repository\" dialog and press Next.\n* Specify the version using rule \"Up to Next Major\" with \"1.0.6\" as its earliest version and press Next.\n* Xcode will try to resolving the version, after this, you can choose the `MBAdminSwift` library and add it to your app target.\n\n## CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa Projects, which automates and simplifies the process of using 3rd-party libraries in your projects. You can install CocoaPods with the following command:\n\n```ruby\n$ gem install cocoapods\n```\n\nTo integrate the MBurgerSwift into your Xcode project using CocoaPods, specify it in your Podfile:\n\n```ruby\nplatform :ios, '10.0'\n\ntarget 'TargetName' do\n    pod 'MBAdminSwift' '~\u003e 1.0.6'\nend\n```\n\n## Chartage\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate MBAdmin into your Xcode project using Carthage, specify it in your Cartfile:\n\n```\ngithub \"Mumble-SRL/MBAdminSwift\"\n```\n\n## Manual installation\n\nTo install the library manually drag and drop the folder `MBAdminSwift` to your project structure in XCode. \n\nNote that `MBAdminSwift` has `MBurgerSwift` as a dependency, so you have to install also this library manually.\n\n# Add/Edit a section\n\nYou can add a section to a block with the function `addSectionToBlock(withBlockId:elements:success:failure:)`. To call this function you need to create an array of elements confrom to `MBUploadableElementProtocol`. To create it use the `MBUploadableElementsFactory` that is created. A MBUploadableElementsFactory is allocated with a locale identifier and creates object with this locale identifier. All the integrity controls of the server are still present in the APIs, you will find the description of the error in the object passed to the failure block. Below an example code to create a section. \n\n```swift\nlet factory = MBUploadableElementsFactory(localeIdentifier: \"it\")\nlet elements: [MBUplodableElementProtocol] = [factory.createTextElement(name: \"name\", text: \"text\"),\nfactory.createImageElement(name: \"name\", image: UIImage(named: \"image_name\")!)]\n\nMBAdmin.addSectionToBlock(withBlockId: 621, elements: elements, success: { sectionId in\n\n}, failure: { (error) in\n            \n})         \n```\n\nWith a `MBUploadableElementsFactory` you can create: \n\n* an array or a single of image with `MBUploadableImagesElement`\n* an array or a single of image with `MBUploadableFilesElement`\n* a text with `MBUploadableTextElement`\n* a checkbox element with `MBUploadableCheckboxElement`\n\nThe edit function is very similar to the add. It will modifiy only the fields passed and the other elements will remain untouched.\n\n# Delete a section\n\nTo delete a section with an id:\n\n```swift\nMBAdmin.deleteSection(withSectionId: SECTION_ID, success: {\n\n}, failure: { (error) in\n      \n})\n\n```\n\n# Upload media\n\nYou can upload media in 2 ways:\n\n- Uploading images, giving them names. In that case images will be converted in `jpg` (you can specify the compression quality).\n- Uploading files with their URL.\n\nTo upload an image or multiple images:\n\n```swift\nlet image1: UIImage = AN_IMAGE\nlet image2: UIImage = ANOTHER_IMAGE\n\n// Upload a single image\t\t\nMBAdmin.uploadMediaImage(image: image1,\n                         name: \"Image name\",\n                         success: { media in\n            \n}, failure: { error in\n            \n})\n\n// Upload multiple images\nMBAdmin.uploadMediaImages(images: [image1, image2],\n                          names: [\"Image1\", \"Image2\"],\n                          success: { media in\n            \n}, failure: { error in\n            \n})\n\n```\nTo upload files with their URLs:\n\n```swift\nlet file1Url: URL = AN_URL\nlet file2Url: URL = ANOTHER_URL\n        \n// Upload a single file\nMBAdmin.uploadMedia(media: file1Url,\n                    success: { media in\n                                \n                    },\n                    failure: { error in\n                                \n                    })\n        \n// Upload an array of files\nMBAdmin.uploadMedia(media: [file1Url, file2Url],\n                    success: { media in\n                                \n                    },\n                    failure: { error in\n                                \n                    })\n```\n\n# Delete media\n\nYou can delete a media(`MBFile`) using `deleteMedia(withMediaId:success:failure:)` that requires the id of the media to delete. The id of the media is the field id of the `MBFile`.\n\n```swift\nMBAdmin.deleteMedia(withMediaId: MEDIA_ID, success: {\n            \n}, failure: { (error) in\n            \n})\n```\n\n# Documentation\n\nFor additional information, you can check out the full [docs](https://github.com/Mumble-SRL/MBAdmin/tree/master/docs).\n\nSince this SDK extends [MBurger](https://github.com/Mumble-SRL/MBurgerSwift), you can check out the full [reference doc](https://github.com/Mumble-SRL/MBurgerSwift/tree/master/docs) of the MBurger SDK.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumble-srl%2Fmbadminswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmumble-srl%2Fmbadminswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumble-srl%2Fmbadminswift/lists"}