diff --git a/Package.swift b/Package.swift
index 67c8f32..66ba6d4 100644
--- a/Package.swift
+++ b/Package.swift
@@ -5,6 +5,7 @@ import PackageDescription
let package = Package(
name: "MMRatingView",
+ platforms: [.iOS(.v13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
@@ -20,7 +21,7 @@ let package = Package(
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "MMRatingView",
- dependencies: []),
+ dependencies: [], resources: [.process("MMRatingAssets")]),
.testTarget(
name: "MMRatingViewTests",
dependencies: ["MMRatingView"]),
diff --git a/README.md b/README.md
index a528c12..987e059 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
# MMRatingView
-A description of this package.
+Customisable Rating View for swiftUI.
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/Contents.json
new file mode 100644
index 0000000..6cacf46
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-baseball-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/sports-baseball-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/sports-baseball-24px.svg
new file mode 100644
index 0000000..427e14b
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.fill.imageset/sports-baseball-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/Contents.json
new file mode 100644
index 0000000..6f6e476
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-baseball-outlined-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/sports-baseball-outlined-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/sports-baseball-outlined-24px.svg
new file mode 100644
index 0000000..300c678
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/baseball.imageset/sports-baseball-outlined-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/Contents.json
new file mode 100644
index 0000000..8ec1123
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-basketball-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/sports-basketball-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/sports-basketball-24px.svg
new file mode 100644
index 0000000..95974a1
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.fill.imageset/sports-basketball-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/Contents.json
new file mode 100644
index 0000000..3250a12
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-basketball-outlined-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/sports-basketball-outlined-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/sports-basketball-outlined-24px.svg
new file mode 100644
index 0000000..7aed45c
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/basketball.imageset/sports-basketball-outlined-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/Contents.json
new file mode 100644
index 0000000..a23a500
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-football-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/sports-football-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/sports-football-24px.svg
new file mode 100644
index 0000000..7e55fba
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.fill.imageset/sports-football-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/Contents.json b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/Contents.json
new file mode 100644
index 0000000..924f13e
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "sports-football-outlined-24px.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/sports-football-outlined-24px.svg b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/sports-football-outlined-24px.svg
new file mode 100644
index 0000000..17a11da
--- /dev/null
+++ b/Sources/MMRatingView/Assets/MMRatingAssets.xcassets/football.imageset/sports-football-outlined-24px.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Sources/MMRatingView/MMRatingView.swift b/Sources/MMRatingView/MMRatingView.swift
new file mode 100644
index 0000000..4324c15
--- /dev/null
+++ b/Sources/MMRatingView/MMRatingView.swift
@@ -0,0 +1,83 @@
+//
+// MMRatingView.swift
+//
+//
+// Created by Manish Patidar on 28/08/22.
+//
+
+import SwiftUI
+
+/// A view of inline images that represents a rating.
+/// Tapping on an image will change it from an unfilled to a filled version of the image.
+///
+/// The following example shows a MMRatingView with a maximum rating of 10 red flags, each with a width of 20:
+///
+/// MMRatingView(maxRating: 10,
+/// currentRating: $currentRating,
+/// width: 20,
+/// color: .red,
+/// ratingImage: .flag)
+///
+///
+public struct MMRatingView: View {
+
+ @Binding var currentRating: Int
+
+ var maxRating: Int
+ var width:Int
+ var color: UIColor
+ var ratingImage: RatingImageType
+
+ /// Only two required parameters are maxRating and the binding to currentRating. All other parameters have default values
+ /// - Parameters:
+ /// - maxRating: The maximum rating on the scale
+ /// - currentRating: A binding to the current rating variable
+ /// - width: The width of the image used for the rating (Default - 20)
+ /// - color: The color of the image ( (Default - systemYellow)
+ /// - ratingImage: An enum representing the image used for the rating (Default - .star)
+ ///
+ public init(maxRating: Int,
+ currentRating: Binding,
+ width: Int = 20,
+ color: UIColor = .systemYellow,
+ ratingImage: RatingImageType = .star) {
+ self.maxRating = maxRating
+ self._currentRating = currentRating
+ self.width = width
+ self.color = color
+ self.ratingImage = ratingImage
+ }
+
+ public var body: some View {
+ HStack {
+ ForEach(0.. Image {
+ if rating < currentRating {
+ return ratingImage.fillImage
+ } else {
+ return ratingImage.openImage
+ }
+ }
+}
+
+struct MMRatingView_Previews: PreviewProvider {
+ static var previews: some View {
+ MMRatingView(maxRating: 5, currentRating: .constant(3))
+ .environment(\.colorScheme, .light)
+ .previewLayout(.sizeThatFits)
+ .padding(10)
+ }
+}
+
diff --git a/Sources/MMRatingView/RatingImageType.swift b/Sources/MMRatingView/RatingImageType.swift
new file mode 100644
index 0000000..a828e1e
--- /dev/null
+++ b/Sources/MMRatingView/RatingImageType.swift
@@ -0,0 +1,41 @@
+//
+// MMRatingView.swift
+//
+// Created by Manish Patidar on 28/08/22.
+//
+
+import SwiftUI
+
+public enum RatingImageType: String {
+
+ case star = "SF_star"
+ case heart = "SF_heart"
+ case thumbsUp = "SF_hand.thumbsup"
+ case bookmark = "SF_bookmark"
+ case flag = "SF_flag"
+ case bell = "SF_bell"
+
+ case baseball
+ case basketball
+ case football
+ case custom
+
+ var fillImage: Image {
+ rawValue.prefix(3) == "SF_" ?
+ Image(systemName: String(rawValue.dropFirst(3)) + ".fill")
+ :
+ rawValue == "custom" ?
+ Image("\(rawValue).fill")
+ :
+ Image("\(rawValue).fill", bundle: .module)
+ }
+ var openImage: Image {
+ rawValue.prefix(3) == "SF_" ?
+ Image(systemName: String(rawValue.dropFirst(3)))
+ :
+ rawValue == "custom" ?
+ Image(rawValue)
+ :
+ Image(rawValue, bundle: .module)
+ }
+}